Repository: camel Updated Branches: refs/heads/master a3b9b0f38 -> 99dff7d7f
CAMEL-10786: Polished Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/99dff7d7 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/99dff7d7 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/99dff7d7 Branch: refs/heads/master Commit: 99dff7d7f48550cb7bbb4fb865822ab4e7d8a94d Parents: a3b9b0f Author: Claus Ibsen <davscl...@apache.org> Authored: Tue Feb 14 09:35:24 2017 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Tue Feb 14 09:35:24 2017 +0100 ---------------------------------------------------------------------- .../camel/component/azure/blob/BlobBlock.java | 17 ++-- .../azure/blob/BlobServiceConfiguration.java | 1 - .../azure/blob/BlobServiceConsumer.java | 2 +- .../azure/blob/BlobServiceEndpoint.java | 10 +-- .../azure/blob/BlobServiceProducer.java | 4 +- .../azure/blob/BlobServiceRequestOptions.java | 12 ++- .../component/azure/blob/BlobServiceUtil.java | 81 +++++++++++--------- .../services/org/apache/camel/TypeConverter | 17 ---- .../blob/BlobServiceAppendConsumerTest.java | 1 - .../blob/BlobServiceBlockConsumerTest.java | 1 - .../BlobServiceComponentConfigurationTest.java | 4 +- .../blob/BlobServiceProducerSpringTest.java | 6 +- .../azure/blob/BlobServiceUtilTest.java | 3 +- .../src/test/resources/log4j2.properties | 2 +- .../BlobServiceProducerSpringTest-context.xml | 27 +++---- 15 files changed, 86 insertions(+), 102 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/99dff7d7/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobBlock.java ---------------------------------------------------------------------- diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobBlock.java b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobBlock.java index 87946ae..f85093f 100644 --- a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobBlock.java +++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobBlock.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,26 +26,31 @@ import com.microsoft.azure.storage.core.Base64; public class BlobBlock { private InputStream blockStream; private BlockEntry blockEntry; + public BlobBlock(InputStream blockStream) { this(Base64.encode(UUID.randomUUID().toString().getBytes()), - blockStream); + blockStream); } + public BlobBlock(String blockId, InputStream blockStream) { this(blockId, BlockSearchMode.LATEST, blockStream); } + public BlobBlock(String blockId, BlockSearchMode searchMode, InputStream blockStream) { this(new BlockEntry(blockId, searchMode), blockStream); } + public BlobBlock(BlockEntry blockEntry, InputStream blockStream) { this.blockStream = blockStream; this.blockEntry = blockEntry; } + public InputStream getBlockStream() { return blockStream; } + public BlockEntry getBlockEntry() { return blockEntry; } - - + } http://git-wip-us.apache.org/repos/asf/camel/blob/99dff7d7/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceConfiguration.java b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceConfiguration.java index ea155c4..c6f47a5 100644 --- a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceConfiguration.java +++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceConfiguration.java @@ -223,7 +223,6 @@ public class BlobServiceConfiguration extends AbstractConfiguration { * Blobs can be public for reading their content, if this property is enabled * then the credentials do not have to be set */ - public void setPublicForRead(boolean publicForRead) { this.publicForRead = publicForRead; } http://git-wip-us.apache.org/repos/asf/camel/blob/99dff7d7/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceConsumer.java ---------------------------------------------------------------------- diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceConsumer.java b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceConsumer.java index d91c02c..d712d1d 100644 --- a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceConsumer.java +++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceConsumer.java @@ -60,10 +60,10 @@ public class BlobServiceConsumer extends ScheduledPollConsumer { protected BlobServiceConfiguration getConfiguration() { return getEndpoint().getConfiguration(); } + @Override public BlobServiceEndpoint getEndpoint() { return (BlobServiceEndpoint) super.getEndpoint(); } - } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/99dff7d7/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceEndpoint.java b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceEndpoint.java index d2aaa8c..d725dbf 100644 --- a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceEndpoint.java +++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceEndpoint.java @@ -35,7 +35,7 @@ import org.slf4j.LoggerFactory; title = "Azure Storage Blob Service", syntax = "azure-blob:containerOrBlobUri", consumerClass = BlobServiceConsumer.class, - label = "cloud, blob") + label = "cloud,database,nosql") public class BlobServiceEndpoint extends DefaultEndpoint { private static final Logger LOG = LoggerFactory.getLogger(BlobServiceEndpoint.class); @@ -45,7 +45,6 @@ public class BlobServiceEndpoint extends DefaultEndpoint { private String containerOrBlobUri; // to support component docs @UriParam private BlobServiceConfiguration configuration; - public BlobServiceEndpoint(String uri, Component comp, BlobServiceConfiguration configuration) { super(uri, comp); @@ -77,11 +76,6 @@ public class BlobServiceEndpoint extends DefaultEndpoint { return true; } - @Override - public void doStart() throws Exception { - super.doStart(); - } - public BlobServiceConfiguration getConfiguration() { return configuration; } @@ -89,7 +83,5 @@ public class BlobServiceEndpoint extends DefaultEndpoint { public void setConfiguration(BlobServiceConfiguration configuration) { this.configuration = configuration; } - - } http://git-wip-us.apache.org/repos/asf/camel/blob/99dff7d7/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceProducer.java b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceProducer.java index f50c115..b2faaf5 100644 --- a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceProducer.java +++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceProducer.java @@ -48,7 +48,6 @@ import org.apache.camel.util.URISupport; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - /** * A Producer which sends messages to the Azure Storage Blob Service */ @@ -60,7 +59,6 @@ public class BlobServiceProducer extends DefaultProducer { super(endpoint); } - @Override public void process(final Exchange exchange) throws Exception { BlobServiceOperations operation = determineOperation(exchange); @@ -434,7 +432,6 @@ public class BlobServiceProducer extends DefaultProducer { } } - private BlobServiceOperations determineOperation(Exchange exchange) { BlobServiceOperations operation = exchange.getIn().getHeader(BlobServiceConstants.OPERATION, BlobServiceOperations.class); if (operation == null) { @@ -478,4 +475,5 @@ public class BlobServiceProducer extends DefaultProducer { inputStream.close(); } } + } http://git-wip-us.apache.org/repos/asf/camel/blob/99dff7d7/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceRequestOptions.java ---------------------------------------------------------------------- diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceRequestOptions.java b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceRequestOptions.java index 6e0b237..5f48dc6 100644 --- a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceRequestOptions.java +++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceRequestOptions.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,21 +24,27 @@ public class BlobServiceRequestOptions { private AccessCondition accessCond; private BlobRequestOptions requestOpts; private OperationContext opContext; + public AccessCondition getAccessCond() { return accessCond; } + public void setAccessCond(AccessCondition accessCond) { this.accessCond = accessCond; } + public BlobRequestOptions getRequestOpts() { return requestOpts; } + public void setRequestOpts(BlobRequestOptions requestOpts) { this.requestOpts = requestOpts; } + public OperationContext getOpContext() { return opContext; } + public void setOpContext(OperationContext opContext) { this.opContext = opContext; } http://git-wip-us.apache.org/repos/asf/camel/blob/99dff7d7/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceUtil.java ---------------------------------------------------------------------- diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceUtil.java b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceUtil.java index 274bffa..d4c647e 100644 --- a/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceUtil.java +++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceUtil.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -37,11 +37,13 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public final class BlobServiceUtil { + private static final Logger LOG = LoggerFactory.getLogger(BlobServiceUtil.class); - + private BlobServiceUtil() { } - public static void getBlob(Exchange exchange, BlobServiceConfiguration cfg) + + public static void getBlob(Exchange exchange, BlobServiceConfiguration cfg) throws Exception { switch (cfg.getBlobType()) { case blockblob: @@ -52,27 +54,29 @@ public final class BlobServiceUtil { break; case pageblob: getPageBlob(exchange, cfg); - break; + break; default: throw new IllegalArgumentException("Unsupported blob type"); } } - - private static void getBlockBlob(Exchange exchange, BlobServiceConfiguration cfg) + + private static void getBlockBlob(Exchange exchange, BlobServiceConfiguration cfg) throws Exception { CloudBlockBlob client = createBlockBlobClient(cfg, false); doGetBlob(client, exchange, cfg); } + private static void getAppendBlob(Exchange exchange, BlobServiceConfiguration cfg) throws Exception { CloudAppendBlob client = createAppendBlobClient(cfg, false); doGetBlob(client, exchange, cfg); } + private static void getPageBlob(Exchange exchange, BlobServiceConfiguration cfg) throws Exception { CloudPageBlob client = createPageBlobClient(cfg, false); doGetBlob(client, exchange, cfg); } - - private static void doGetBlob(CloudBlob client, Exchange exchange, BlobServiceConfiguration cfg) + + private static void doGetBlob(CloudBlob client, Exchange exchange, BlobServiceConfiguration cfg) throws Exception { BlobServiceUtil.configureCloudBlobForRead(client, cfg); BlobServiceRequestOptions opts = getRequestOptions(exchange); @@ -94,7 +98,7 @@ public final class BlobServiceUtil { String name = cfg.getBlobName(); File file = new File(fileDir, name + ".blob"); ExchangeUtil.getMessageForResponse(exchange).setBody(file); - os = new FileOutputStream(file); + os = new FileOutputStream(file); } } if (os == null) { @@ -102,22 +106,24 @@ public final class BlobServiceUtil { } try { client.downloadRange(blobOffset, blobDataLength, os, - opts.getAccessCond(), opts.getRequestOpts(), opts.getOpContext()); + opts.getAccessCond(), opts.getRequestOpts(), opts.getOpContext()); } finally { if (cfg.isCloseStreamAfterRead()) { os.close(); } } } - public static CloudBlobContainer createBlobContainerClient(BlobServiceConfiguration cfg) + + public static CloudBlobContainer createBlobContainerClient(BlobServiceConfiguration cfg) throws Exception { URI uri = prepareStorageBlobUri(cfg, false); StorageCredentials creds = getAccountCredentials(cfg, false); return new CloudBlobContainer(uri, creds); } - public static CloudBlockBlob createBlockBlobClient(BlobServiceConfiguration cfg, boolean isWrite) + + public static CloudBlockBlob createBlockBlobClient(BlobServiceConfiguration cfg, boolean isWrite) throws Exception { - CloudBlockBlob client = (CloudBlockBlob)getConfiguredClient(cfg, BlobType.blockblob, isWrite); + CloudBlockBlob client = (CloudBlockBlob) getConfiguredClient(cfg, BlobType.blockblob, isWrite); if (client == null) { URI uri = prepareStorageBlobUri(cfg); StorageCredentials creds = getAccountCredentials(cfg, isWrite); @@ -125,9 +131,10 @@ public final class BlobServiceUtil { } return client; } + public static CloudAppendBlob createAppendBlobClient(BlobServiceConfiguration cfg, boolean isWrite) throws Exception { - CloudAppendBlob client = (CloudAppendBlob)getConfiguredClient(cfg, BlobType.appendblob, isWrite); + CloudAppendBlob client = (CloudAppendBlob) getConfiguredClient(cfg, BlobType.appendblob, isWrite); if (client == null) { URI uri = prepareStorageBlobUri(cfg); StorageCredentials creds = getAccountCredentials(cfg, isWrite); @@ -135,10 +142,10 @@ public final class BlobServiceUtil { } return client; } - + public static CloudPageBlob createPageBlobClient(BlobServiceConfiguration cfg, boolean isWrite) throws Exception { - CloudPageBlob client = (CloudPageBlob)getConfiguredClient(cfg, BlobType.pageblob, isWrite); + CloudPageBlob client = (CloudPageBlob) getConfiguredClient(cfg, BlobType.pageblob, isWrite); if (client == null) { URI uri = prepareStorageBlobUri(cfg); StorageCredentials creds = getAccountCredentials(cfg, isWrite); @@ -146,7 +153,7 @@ public final class BlobServiceUtil { } return client; } - + public static CloudBlob getConfiguredClient(BlobServiceConfiguration cfg, BlobType blobType, boolean isWrite) { @@ -154,11 +161,11 @@ public final class BlobServiceUtil { if (client != null) { Class<?> expectedCls = null; if (blobType == BlobType.blockblob) { - expectedCls = CloudBlockBlob.class; + expectedCls = CloudBlockBlob.class; } else if (blobType == BlobType.appendblob) { - expectedCls = CloudAppendBlob.class; + expectedCls = CloudAppendBlob.class; } else if (blobType == BlobType.pageblob) { - expectedCls = CloudPageBlob.class; + expectedCls = CloudPageBlob.class; } if (client.getClass() != expectedCls) { throw new IllegalArgumentException("Invalid Blob Client Type"); @@ -172,9 +179,9 @@ public final class BlobServiceUtil { } return client; } - + public static StorageCredentials getAccountCredentials(BlobServiceConfiguration cfg, - boolean isWrite) { + boolean isWrite) { if (cfg.getCredentials() == null && (isWrite || !cfg.isPublicForRead())) { throw new IllegalArgumentException("Storage credentials must be specified"); } @@ -186,42 +193,42 @@ public final class BlobServiceUtil { client.setStreamMinimumReadSizeInBytes(cfg.getStreamReadSize()); } } - + public static URI prepareStorageBlobUri(BlobServiceConfiguration cfg) { return prepareStorageBlobUri(cfg, true); } - + public static URI prepareStorageBlobUri(BlobServiceConfiguration cfg, boolean blobNameRequired) { if (blobNameRequired && cfg.getBlobName() == null) { throw new IllegalArgumentException("Blob name must be specified"); } - + StringBuilder uriBuilder = new StringBuilder(); uriBuilder.append("https://") - .append(cfg.getAccountName()) - .append(BlobServiceConstants.SERVICE_URI_SEGMENT) - .append("/") - .append(cfg.getContainerName()); + .append(cfg.getAccountName()) + .append(BlobServiceConstants.SERVICE_URI_SEGMENT) + .append("/") + .append(cfg.getContainerName()); if (cfg.getBlobName() != null) { uriBuilder.append("/") - .append(cfg.getBlobName()); + .append(cfg.getBlobName()); } return URI.create(uriBuilder.toString()); } - + public static BlobServiceRequestOptions getRequestOptions(Exchange exchange) { BlobServiceRequestOptions opts = exchange.getIn().getBody(BlobServiceRequestOptions.class); if (opts != null) { - return opts; + return opts; } else { opts = new BlobServiceRequestOptions(); } - AccessCondition accessCond = + AccessCondition accessCond = exchange.getIn().getHeader(BlobServiceConstants.ACCESS_CONDITION, AccessCondition.class); - BlobRequestOptions requestOpts = + BlobRequestOptions requestOpts = exchange.getIn().getHeader(BlobServiceConstants.BLOB_REQUEST_OPTIONS, BlobRequestOptions.class); - OperationContext opContext = + OperationContext opContext = exchange.getIn().getHeader(BlobServiceConstants.OPERATION_CONTEXT, OperationContext.class); opts.setAccessCond(accessCond); opts.setOpContext(opContext); http://git-wip-us.apache.org/repos/asf/camel/blob/99dff7d7/components/camel-azure/src/main/resources/META-INF/services/org/apache/camel/TypeConverter ---------------------------------------------------------------------- diff --git a/components/camel-azure/src/main/resources/META-INF/services/org/apache/camel/TypeConverter b/components/camel-azure/src/main/resources/META-INF/services/org/apache/camel/TypeConverter deleted file mode 100644 index ded98e1..0000000 --- a/components/camel-azure/src/main/resources/META-INF/services/org/apache/camel/TypeConverter +++ /dev/null @@ -1,17 +0,0 @@ -## --------------------------------------------------------------------------- -## Licensed to the Apache Software Foundation (ASF) under one or more -## contributor license agreements. See the NOTICE file distributed with -## this work for additional information regarding copyright ownership. -## The ASF licenses this file to You under the Apache License, Version 2.0 -## (the "License"); you may not use this file except in compliance with -## the License. You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. -## --------------------------------------------------------------------------- - http://git-wip-us.apache.org/repos/asf/camel/blob/99dff7d7/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceAppendConsumerTest.java ---------------------------------------------------------------------- diff --git a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceAppendConsumerTest.java b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceAppendConsumerTest.java index 34fef1c..c979e37 100644 --- a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceAppendConsumerTest.java +++ b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceAppendConsumerTest.java @@ -34,7 +34,6 @@ import org.apache.camel.util.IOHelper; import org.junit.Ignore; import org.junit.Test; - public class BlobServiceAppendConsumerTest extends CamelTestSupport { @EndpointInject(uri = "direct:start") ProducerTemplate templateStart; http://git-wip-us.apache.org/repos/asf/camel/blob/99dff7d7/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceBlockConsumerTest.java ---------------------------------------------------------------------- diff --git a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceBlockConsumerTest.java b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceBlockConsumerTest.java index 19b9920..d47b652 100644 --- a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceBlockConsumerTest.java +++ b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceBlockConsumerTest.java @@ -34,7 +34,6 @@ import org.apache.camel.util.IOHelper; import org.junit.Ignore; import org.junit.Test; - public class BlobServiceBlockConsumerTest extends CamelTestSupport { @EndpointInject(uri = "direct:start") ProducerTemplate templateStart; http://git-wip-us.apache.org/repos/asf/camel/blob/99dff7d7/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceComponentConfigurationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceComponentConfigurationTest.java b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceComponentConfigurationTest.java index ab23553..944de0b 100644 --- a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceComponentConfigurationTest.java +++ b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceComponentConfigurationTest.java @@ -185,11 +185,9 @@ public class BlobServiceComponentConfigurationTest extends CamelTestSupport { private static void createConsumer(Endpoint endpoint) throws Exception { endpoint.createConsumer(new Processor() { - @Override public void process(Exchange exchange) throws Exception { - // TODO Auto-generated method stub - + // noop } }); } http://git-wip-us.apache.org/repos/asf/camel/blob/99dff7d7/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceProducerSpringTest.java ---------------------------------------------------------------------- diff --git a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceProducerSpringTest.java b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceProducerSpringTest.java index 05265a4..b65b769 100644 --- a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceProducerSpringTest.java +++ b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceProducerSpringTest.java @@ -54,7 +54,6 @@ public class BlobServiceProducerSpringTest extends CamelSpringTestSupport { assertMockEndpointsSatisfied(); assertResultExchange(result.getExchanges().get(0)); - } @Test @@ -71,8 +70,8 @@ public class BlobServiceProducerSpringTest extends CamelSpringTestSupport { assertMockEndpointsSatisfied(); assertResultExchange(result.getExchanges().get(0)); - } + @Test @Ignore public void testGetBlockBlob() throws Exception { @@ -87,7 +86,6 @@ public class BlobServiceProducerSpringTest extends CamelSpringTestSupport { assertMockEndpointsSatisfied(); assertResultExchange(result.getExchanges().get(0)); - } @Test @@ -104,7 +102,6 @@ public class BlobServiceProducerSpringTest extends CamelSpringTestSupport { assertMockEndpointsSatisfied(); assertResultExchange(result.getExchanges().get(0)); - } @Test @@ -122,7 +119,6 @@ public class BlobServiceProducerSpringTest extends CamelSpringTestSupport { assertMockEndpointsSatisfied(); assertResultExchange(result.getExchanges().get(0)); - } private void assertResultExchange(Exchange resultExchange) { http://git-wip-us.apache.org/repos/asf/camel/blob/99dff7d7/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceUtilTest.java ---------------------------------------------------------------------- diff --git a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceUtilTest.java b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceUtilTest.java index 404daff..26bba46 100644 --- a/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceUtilTest.java +++ b/components/camel-azure/src/test/java/org/apache/camel/component/azure/blob/BlobServiceUtilTest.java @@ -26,8 +26,8 @@ import org.apache.camel.impl.PropertyPlaceholderDelegateRegistry; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; - public class BlobServiceUtilTest extends CamelTestSupport { + @Test public void testPrepareUri() throws Exception { registerCredentials(); @@ -39,6 +39,7 @@ public class BlobServiceUtilTest extends CamelTestSupport { BlobServiceUtil.prepareStorageBlobUri(endpoint.getConfiguration()); assertEquals("https://camelazure.blob.core.windows.net/container/blob", uri.toString()); } + private void registerCredentials() { StorageCredentials creds = new StorageCredentialsAccountAndKey("camelazure", Base64.encode("key".getBytes())); http://git-wip-us.apache.org/repos/asf/camel/blob/99dff7d7/components/camel-azure/src/test/resources/log4j2.properties ---------------------------------------------------------------------- diff --git a/components/camel-azure/src/test/resources/log4j2.properties b/components/camel-azure/src/test/resources/log4j2.properties index 07111be..8ae19d4 100644 --- a/components/camel-azure/src/test/resources/log4j2.properties +++ b/components/camel-azure/src/test/resources/log4j2.properties @@ -17,7 +17,7 @@ appender.file.type = File appender.file.name = file -appender.file.fileName = target/camel-aws-test.log +appender.file.fileName = target/camel-azure-test.log appender.file.layout.type = PatternLayout appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n appender.out.type = Console http://git-wip-us.apache.org/repos/asf/camel/blob/99dff7d7/components/camel-azure/src/test/resources/org/apache/camel/component/azure/blob/BlobServiceProducerSpringTest-context.xml ---------------------------------------------------------------------- diff --git a/components/camel-azure/src/test/resources/org/apache/camel/component/azure/blob/BlobServiceProducerSpringTest-context.xml b/components/camel-azure/src/test/resources/org/apache/camel/component/azure/blob/BlobServiceProducerSpringTest-context.xml index fe31fda..0c9abd8 100644 --- a/components/camel-azure/src/test/resources/org/apache/camel/component/azure/blob/BlobServiceProducerSpringTest-context.xml +++ b/components/camel-azure/src/test/resources/org/apache/camel/component/azure/blob/BlobServiceProducerSpringTest-context.xml @@ -1,18 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version - 2.0 (the "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 Unless required by - applicable law or agreed to in writing, software distributed under - the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES - OR CONDITIONS OF ANY KIND, either express or implied. See the - License for the specific language governing permissions and - limitations under the License. + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" @@ -46,11 +47,11 @@ <to uri="azure-blob://camelazure/container1/blob1?credentials=#credentials&operation=updatePageBlob"/> <to uri="mock:result"/> </route> - </camelContext> <bean id="credentials" class="com.microsoft.azure.storage.StorageCredentialsAccountAndKey"> <constructor-arg value="camelazure"/> <constructor-arg value="base64EncodedValue"/> </bean> + </beans>