http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSdbTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSdbTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSdbTest.java deleted file mode 100644 index eb27fda..0000000 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSdbTest.java +++ /dev/null @@ -1,297 +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. - */ -package org.apache.camel.itest.osgi.aws; - -import java.util.Arrays; -import java.util.List; - -import com.amazonaws.services.simpledb.model.Attribute; -import com.amazonaws.services.simpledb.model.DeletableItem; -import com.amazonaws.services.simpledb.model.Item; -import com.amazonaws.services.simpledb.model.ReplaceableAttribute; -import com.amazonaws.services.simpledb.model.ReplaceableItem; -import com.amazonaws.services.simpledb.model.UpdateCondition; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.component.aws.sdb.SdbConstants; -import org.apache.camel.component.aws.sdb.SdbOperations; -import org.apache.camel.impl.DefaultProducerTemplate; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.junit.PaxExam; -import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext; - -@RunWith(PaxExam.class) -public class AwsSdbTest extends AwsTestSupport { - - private AmazonSDBClientMock amazonSDBClient; - - @Override - @Before - public void setUp() throws Exception { - super.setUp(); - - amazonSDBClient = context.getRegistry().lookupByNameAndType("amazonSDBClient", AmazonSDBClientMock.class); - } - - @Override - protected OsgiBundleXmlApplicationContext createApplicationContext() { - return new OsgiBundleXmlApplicationContext(new String[]{"org/apache/camel/itest/osgi/aws/CamelContext.xml"}); - } - - @Test - public void doesntCreateDomainOnStartIfExists() throws Exception { - assertNull(amazonSDBClient.createDomainRequest); - } - - @Test - public void createDomainOnStartIfNotExists() throws Exception { - DefaultProducerTemplate.newInstance(context, "aws-sdb://NonExistingDomain?amazonSDBClient=#amazonSDBClient&operation=GetAttributes"); - - assertEquals("NonExistingDomain", amazonSDBClient.createDomainRequest.getDomainName()); - } - - @Test - public void batchDeleteAttributes() { - final List<DeletableItem> deletableItems = Arrays.asList(new DeletableItem[] { - new DeletableItem("ITEM1", null), - new DeletableItem("ITEM2", null)}); - - template.send("direct:start-sdb", new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.BatchDeleteAttributes); - exchange.getIn().setHeader(SdbConstants.DELETABLE_ITEMS, deletableItems); - } - }); - - assertEquals("TestDomain", amazonSDBClient.batchDeleteAttributesRequest.getDomainName()); - assertEquals(deletableItems, amazonSDBClient.batchDeleteAttributesRequest.getItems()); - } - - @Test - public void batchPutAttributes() { - final List<ReplaceableItem> replaceableItems = Arrays.asList(new ReplaceableItem[] { - new ReplaceableItem("ITEM1")}); - - template.send("direct:start-sdb", new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.BatchPutAttributes); - exchange.getIn().setHeader(SdbConstants.REPLACEABLE_ITEMS, replaceableItems); - } - }); - - assertEquals("TestDomain", amazonSDBClient.batchPutAttributesRequest.getDomainName()); - assertEquals(replaceableItems, amazonSDBClient.batchPutAttributesRequest.getItems()); - } - - @Test - public void deleteAttributes() { - final List<Attribute> attributes = Arrays.asList(new Attribute[] { - new Attribute("NAME1", "VALUE1")}); - final UpdateCondition condition = new UpdateCondition("Key1", "Value1", true); - - template.send("direct:start-sdb", new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.DeleteAttributes); - exchange.getIn().setHeader(SdbConstants.ATTRIBUTES, attributes); - exchange.getIn().setHeader(SdbConstants.ITEM_NAME, "ITEM1"); - exchange.getIn().setHeader(SdbConstants.UPDATE_CONDITION, condition); - } - }); - - assertEquals("TestDomain", amazonSDBClient.deleteAttributesRequest.getDomainName()); - assertEquals("ITEM1", amazonSDBClient.deleteAttributesRequest.getItemName()); - assertEquals(condition, amazonSDBClient.deleteAttributesRequest.getExpected()); - assertEquals(attributes, amazonSDBClient.deleteAttributesRequest.getAttributes()); - } - - @Test - public void deleteAttributesItemNameIsRequired() { - final List<Attribute> attributes = Arrays.asList(new Attribute[] { - new Attribute("NAME1", "VALUE1")}); - final UpdateCondition condition = new UpdateCondition("Key1", "Value1", true); - - Exchange exchange = template.send("direct:start-sdb", new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.DeleteAttributes); - exchange.getIn().setHeader(SdbConstants.ATTRIBUTES, attributes); - exchange.getIn().setHeader(SdbConstants.UPDATE_CONDITION, condition); - } - }); - - Exception exception = exchange.getException(); - assertTrue(exception instanceof IllegalArgumentException); - } - - @Test - public void deleteDomain() { - template.send("direct:start-sdb", new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.DeleteDomain); - } - }); - - assertEquals("TestDomain", amazonSDBClient.deleteDomainRequest.getDomainName()); - } - - @Test - public void domainMetadata() { - Exchange exchange = template.send("direct:start-sdb", new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.DomainMetadata); - } - }); - - assertEquals("TestDomain", amazonSDBClient.domainMetadataRequest.getDomainName()); - - assertEquals(new Integer(10), exchange.getIn().getHeader(SdbConstants.TIMESTAMP)); - assertEquals(new Integer(11), exchange.getIn().getHeader(SdbConstants.ITEM_COUNT)); - assertEquals(new Integer(12), exchange.getIn().getHeader(SdbConstants.ATTRIBUTE_NAME_COUNT)); - assertEquals(new Integer(13), exchange.getIn().getHeader(SdbConstants.ATTRIBUTE_VALUE_COUNT)); - assertEquals(new Long(1000000), exchange.getIn().getHeader(SdbConstants.ATTRIBUTE_NAME_SIZE)); - assertEquals(new Long(2000000), exchange.getIn().getHeader(SdbConstants.ATTRIBUTE_VALUE_SIZE)); - assertEquals(new Long(3000000), exchange.getIn().getHeader(SdbConstants.ITEM_NAME_SIZE)); - } - - @SuppressWarnings("unchecked") - @Test - public void getAttributes() { - final List<String> attributeNames = Arrays.asList(new String[] {"ATTRIBUTE1"}); - - Exchange exchange = template.send("direct:start-sdb", new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.GetAttributes); - exchange.getIn().setHeader(SdbConstants.ITEM_NAME, "ITEM1"); - exchange.getIn().setHeader(SdbConstants.CONSISTENT_READ, Boolean.TRUE); - exchange.getIn().setHeader(SdbConstants.ATTRIBUTE_NAMES, attributeNames); - } - }); - - assertEquals("TestDomain", amazonSDBClient.getAttributesRequest.getDomainName()); - assertEquals("ITEM1", amazonSDBClient.getAttributesRequest.getItemName()); - assertEquals(Boolean.TRUE, amazonSDBClient.getAttributesRequest.getConsistentRead()); - assertEquals(attributeNames, amazonSDBClient.getAttributesRequest.getAttributeNames()); - - List<Attribute> attributes = exchange.getIn().getHeader(SdbConstants.ATTRIBUTES, List.class); - assertEquals(2, attributes.size()); - assertEquals("AttributeOne", attributes.get(0).getName()); - assertEquals("Value One", attributes.get(0).getValue()); - assertEquals("AttributeTwo", attributes.get(1).getName()); - assertEquals("Value Two", attributes.get(1).getValue()); - } - - @Test - public void getAttributesItemNameIsRequired() { - final List<String> attributeNames = Arrays.asList(new String[] {"ATTRIBUTE1"}); - - Exchange exchange = template.send("direct:start-sdb", new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.GetAttributes); - exchange.getIn().setHeader(SdbConstants.CONSISTENT_READ, Boolean.TRUE); - exchange.getIn().setHeader(SdbConstants.ATTRIBUTE_NAMES, attributeNames); - } - }); - - Exception exception = exchange.getException(); - assertTrue(exception instanceof IllegalArgumentException); - } - - @SuppressWarnings({ "unchecked" }) - @Test - public void listDomains() { - Exchange exchange = template.send("direct:start-sdb", new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.ListDomains); - exchange.getIn().setHeader(SdbConstants.MAX_NUMBER_OF_DOMAINS, new Integer(5)); - exchange.getIn().setHeader(SdbConstants.NEXT_TOKEN, "TOKEN1"); - } - }); - - assertEquals(new Integer(5), amazonSDBClient.listDomainsRequest.getMaxNumberOfDomains()); - assertEquals("TOKEN1", amazonSDBClient.listDomainsRequest.getNextToken()); - - List<String> domains = exchange.getIn().getHeader(SdbConstants.DOMAIN_NAMES, List.class); - assertEquals("TOKEN2", exchange.getIn().getHeader(SdbConstants.NEXT_TOKEN)); - assertEquals(2, domains.size()); - assertTrue(domains.contains("DOMAIN1")); - assertTrue(domains.contains("DOMAIN2")); - } - - @Test - public void putAttributes() { - final List<ReplaceableAttribute> replaceableAttributes = Arrays.asList(new ReplaceableAttribute[] { - new ReplaceableAttribute("NAME1", "VALUE1", true)}); - final UpdateCondition updateCondition = new UpdateCondition("NAME1", "VALUE1", true); - - template.send("direct:start-sdb", new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.PutAttributes); - exchange.getIn().setHeader(SdbConstants.ITEM_NAME, "ITEM1"); - exchange.getIn().setHeader(SdbConstants.UPDATE_CONDITION, updateCondition); - exchange.getIn().setHeader(SdbConstants.REPLACEABLE_ATTRIBUTES, replaceableAttributes); - } - }); - - assertEquals("TestDomain", amazonSDBClient.putAttributesRequest.getDomainName()); - assertEquals("ITEM1", amazonSDBClient.putAttributesRequest.getItemName()); - assertEquals(updateCondition, amazonSDBClient.putAttributesRequest.getExpected()); - assertEquals(replaceableAttributes, amazonSDBClient.putAttributesRequest.getAttributes()); - } - - @Test - public void putAttributesItemNameIsRequired() { - final List<ReplaceableAttribute> replaceableAttributes = Arrays.asList(new ReplaceableAttribute[] { - new ReplaceableAttribute("NAME1", "VALUE1", true)}); - final UpdateCondition updateCondition = new UpdateCondition("NAME1", "VALUE1", true); - - Exchange exchange = template.send("direct:start-sdb", new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.PutAttributes); - exchange.getIn().setHeader(SdbConstants.UPDATE_CONDITION, updateCondition); - exchange.getIn().setHeader(SdbConstants.REPLACEABLE_ATTRIBUTES, replaceableAttributes); - } - }); - - Exception exception = exchange.getException(); - assertTrue(exception instanceof IllegalArgumentException); - } - - @SuppressWarnings("unchecked") - @Test - public void select() { - Exchange exchange = template.send("direct:start-sdb", new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.Select); - exchange.getIn().setHeader(SdbConstants.NEXT_TOKEN, "TOKEN1"); - exchange.getIn().setHeader(SdbConstants.CONSISTENT_READ, Boolean.TRUE); - exchange.getIn().setHeader(SdbConstants.SELECT_EXPRESSION, "SELECT NAME1 FROM DOMAIN1 WHERE NAME1 LIKE 'VALUE1'"); - } - }); - - assertEquals(Boolean.TRUE, amazonSDBClient.selectRequest.getConsistentRead()); - assertEquals("TOKEN1", amazonSDBClient.selectRequest.getNextToken()); - assertEquals("SELECT NAME1 FROM DOMAIN1 WHERE NAME1 LIKE 'VALUE1'", amazonSDBClient.selectRequest.getSelectExpression()); - - List<Item> items = exchange.getIn().getHeader(SdbConstants.ITEMS, List.class); - assertEquals("TOKEN2", exchange.getIn().getHeader(SdbConstants.NEXT_TOKEN)); - assertEquals(2, items.size()); - assertEquals("ITEM1", items.get(0).getName()); - assertEquals("ITEM2", items.get(1).getName()); - } -} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSesIntegrationTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSesIntegrationTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSesIntegrationTest.java deleted file mode 100644 index 3b0b7e7..0000000 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSesIntegrationTest.java +++ /dev/null @@ -1,61 +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. - */ -package org.apache.camel.itest.osgi.aws; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.component.aws.ses.SesConstants; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.junit.PaxExam; -import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext; - -@RunWith(PaxExam.class) -@Ignore("Must be manually tested. Provide your own accessKey and secretKey in CamelIntegrationContext.xml!") -public class AwsSesIntegrationTest extends AwsTestSupport { - - @Override - protected OsgiBundleXmlApplicationContext createApplicationContext() { - return new OsgiBundleXmlApplicationContext( - new String[]{"org/apache/camel/itest/osgi/aws/CamelIntegrationContext.xml"}); - } - - @Test - public void sendInOnly() throws Exception { - Exchange exchange = template.send("direct:start-ses", new Processor() { - @Override - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody("This is my message text."); - } - }); - - assertNotNull(exchange.getIn().getHeader(SesConstants.MESSAGE_ID)); - } - - @Test - public void sendInOut() throws Exception { - Exchange exchange = template.request("direct:start-ses", new Processor() { - @Override - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody("This is my message text."); - } - }); - - assertNotNull(exchange.getOut().getHeader(SesConstants.MESSAGE_ID)); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSesTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSesTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSesTest.java deleted file mode 100644 index 83f9649..0000000 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSesTest.java +++ /dev/null @@ -1,58 +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. - */ -package org.apache.camel.itest.osgi.aws; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.component.aws.ses.SesConstants; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.junit.PaxExam; -import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext; - -@RunWith(PaxExam.class) -public class AwsSesTest extends AwsTestSupport { - - @Override - protected OsgiBundleXmlApplicationContext createApplicationContext() { - return new OsgiBundleXmlApplicationContext(new String[]{"org/apache/camel/itest/osgi/aws/CamelContext.xml"}); - } - - @Test - public void sendInOnly() throws Exception { - Exchange exchange = template.send("direct:start-ses", new Processor() { - @Override - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody("This is my message text."); - } - }); - - assertEquals("1", exchange.getIn().getHeader(SesConstants.MESSAGE_ID)); - } - - @Test - public void sendInOut() throws Exception { - Exchange exchange = template.request("direct:start-ses", new Processor() { - @Override - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody("This is my message text."); - } - }); - - assertEquals("1", exchange.getOut().getHeader(SesConstants.MESSAGE_ID)); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSnsIntegrationTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSnsIntegrationTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSnsIntegrationTest.java deleted file mode 100644 index 5054f21..0000000 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSnsIntegrationTest.java +++ /dev/null @@ -1,63 +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. - */ -package org.apache.camel.itest.osgi.aws; - -import org.apache.camel.Exchange; -import org.apache.camel.ExchangePattern; -import org.apache.camel.Processor; -import org.apache.camel.component.aws.sns.SnsConstants; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.junit.PaxExam; -import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext; - -@RunWith(PaxExam.class) -@Ignore("Must be manually tested. Provide your own accessKey and secretKey in CamelIntegrationContext.xml!") -public class AwsSnsIntegrationTest extends AwsTestSupport { - - @Override - protected OsgiBundleXmlApplicationContext createApplicationContext() { - return new OsgiBundleXmlApplicationContext(new String[]{"org/apache/camel/itest/osgi/aws/CamelIntegrationContext.xml"}); - } - - @Test - public void sendInOnly() throws Exception { - Exchange exchange = template.send("direct:start-sns", ExchangePattern.InOnly, new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(SnsConstants.SUBJECT, "This is my subject"); - exchange.getIn().setBody("This is my message text."); - } - }); - - assertNotNull(exchange.getIn().getHeader(SnsConstants.MESSAGE_ID)); - } - - @Test - public void sendInOut() throws Exception { - Exchange exchange = template.send("direct:start-sns", ExchangePattern.InOut, new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(SnsConstants.SUBJECT, "This is my subject"); - exchange.getIn().setBody("This is my message text."); - } - }); - - assertNotNull(exchange.getOut().getHeader(SnsConstants.MESSAGE_ID)); - } - - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSnsTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSnsTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSnsTest.java deleted file mode 100644 index 66e5d08..0000000 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSnsTest.java +++ /dev/null @@ -1,60 +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. - */ -package org.apache.camel.itest.osgi.aws; - -import org.apache.camel.Exchange; -import org.apache.camel.ExchangePattern; -import org.apache.camel.Processor; -import org.apache.camel.component.aws.sns.SnsConstants; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.junit.PaxExam; -import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext; - -@RunWith(PaxExam.class) -public class AwsSnsTest extends AwsTestSupport { - - @Override - protected OsgiBundleXmlApplicationContext createApplicationContext() { - return new OsgiBundleXmlApplicationContext(new String[]{"org/apache/camel/itest/osgi/aws/CamelContext.xml"}); - } - - @Test - public void sendInOnly() throws Exception { - Exchange exchange = template.send("direct:start-sns", ExchangePattern.InOnly, new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(SnsConstants.SUBJECT, "This is my subject text."); - exchange.getIn().setBody("This is my message text."); - } - }); - - assertEquals("dcc8ce7a-7f18-4385-bedd-b97984b4363c", exchange.getIn().getHeader(SnsConstants.MESSAGE_ID)); - } - - @Test - public void sendInOut() throws Exception { - Exchange exchange = template.send("direct:start-sns", ExchangePattern.InOut, new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(SnsConstants.SUBJECT, "This is my subject text."); - exchange.getIn().setBody("This is my message text."); - } - }); - - assertEquals("dcc8ce7a-7f18-4385-bedd-b97984b4363c", exchange.getOut().getHeader(SnsConstants.MESSAGE_ID)); - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSqsIntegrationTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSqsIntegrationTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSqsIntegrationTest.java deleted file mode 100644 index c4bf03c..0000000 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSqsIntegrationTest.java +++ /dev/null @@ -1,88 +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. - */ -package org.apache.camel.itest.osgi.aws; - -import org.apache.camel.EndpointInject; -import org.apache.camel.Exchange; -import org.apache.camel.ExchangePattern; -import org.apache.camel.Processor; -import org.apache.camel.component.aws.sqs.SqsConstants; -import org.apache.camel.component.mock.MockEndpoint; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.junit.PaxExam; -import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext; - -@RunWith(PaxExam.class) -@Ignore("Must be manually tested. Provide your own accessKey and secretKey in CamelIntegrationContext.xml!") -public class AwsSqsIntegrationTest extends AwsTestSupport { - - @EndpointInject(uri = "mock:result") - private MockEndpoint result; - - @Override - protected OsgiBundleXmlApplicationContext createApplicationContext() { - return new OsgiBundleXmlApplicationContext(new String[]{"org/apache/camel/itest/osgi/aws/CamelIntegrationContext.xml"}); - } - - @Test - public void sendInOnly() throws Exception { - result.expectedMessageCount(1); - - Exchange exchange = template.send("direct:start", ExchangePattern.InOnly, new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody("This is my message text."); - } - }); - - assertMockEndpointsSatisfied(); - - Exchange resultExchange = result.getExchanges().get(0); - assertEquals("This is my message text.", resultExchange.getIn().getBody()); - assertNotNull(resultExchange.getIn().getHeader(SqsConstants.MESSAGE_ID)); - assertNotNull(resultExchange.getIn().getHeader(SqsConstants.RECEIPT_HANDLE)); - assertEquals("6a1559560f67c5e7a7d5d838bf0272ee", resultExchange.getIn().getHeader(SqsConstants.MD5_OF_BODY)); - assertNotNull(resultExchange.getIn().getHeader(SqsConstants.ATTRIBUTES)); - - assertNotNull(exchange.getIn().getHeader(SqsConstants.MESSAGE_ID)); - assertEquals("6a1559560f67c5e7a7d5d838bf0272ee", resultExchange.getIn().getHeader(SqsConstants.MD5_OF_BODY)); - } - - @Test - public void sendInOut() throws Exception { - result.expectedMessageCount(1); - - Exchange exchange = template.send("direct:start", ExchangePattern.InOut, new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody("This is my message text."); - } - }); - - assertMockEndpointsSatisfied(); - - Exchange resultExchange = result.getExchanges().get(0); - assertEquals("This is my message text.", resultExchange.getIn().getBody()); - assertNotNull(resultExchange.getIn().getHeader(SqsConstants.RECEIPT_HANDLE)); - assertNotNull(resultExchange.getIn().getHeader(SqsConstants.MESSAGE_ID)); - assertEquals("6a1559560f67c5e7a7d5d838bf0272ee", resultExchange.getIn().getHeader(SqsConstants.MD5_OF_BODY)); - assertNotNull(resultExchange.getIn().getHeader(SqsConstants.ATTRIBUTES)); - - assertNotNull(exchange.getOut().getHeader(SqsConstants.MESSAGE_ID)); - assertEquals("6a1559560f67c5e7a7d5d838bf0272ee", exchange.getOut().getHeader(SqsConstants.MD5_OF_BODY)); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSqsTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSqsTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSqsTest.java deleted file mode 100644 index 1bc909f..0000000 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSqsTest.java +++ /dev/null @@ -1,89 +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. - */ -package org.apache.camel.itest.osgi.aws; - -import org.apache.camel.EndpointInject; -import org.apache.camel.Exchange; -import org.apache.camel.ExchangePattern; -import org.apache.camel.Processor; -import org.apache.camel.component.aws.sqs.SqsConstants; -import org.apache.camel.component.mock.MockEndpoint; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.junit.PaxExam; -import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext; - - -@RunWith(PaxExam.class) -public class AwsSqsTest extends AwsTestSupport { - - @EndpointInject(uri = "mock:result") - private MockEndpoint result; - - @Override - protected OsgiBundleXmlApplicationContext createApplicationContext() { - return new OsgiBundleXmlApplicationContext(new String[]{"org/apache/camel/itest/osgi/aws/CamelContext.xml"}); - } - - @Test - public void sendInOnly() throws Exception { - result.expectedMessageCount(1); - - Exchange exchange = template.send("direct:start", ExchangePattern.InOnly, new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody("This is my message text."); - } - }); - - assertMockEndpointsSatisfied(); - - Exchange resultExchange = result.getExchanges().get(0); - assertEquals("This is my message text.", resultExchange.getIn().getBody()); - assertNotNull(resultExchange.getIn().getHeader(SqsConstants.MESSAGE_ID)); - assertNotNull(resultExchange.getIn().getHeader(SqsConstants.RECEIPT_HANDLE)); - assertEquals("6a1559560f67c5e7a7d5d838bf0272ee", resultExchange.getIn().getHeader(SqsConstants.MD5_OF_BODY)); - assertNotNull(resultExchange.getIn().getHeader(SqsConstants.ATTRIBUTES)); - - assertNotNull(exchange.getIn().getHeader(SqsConstants.MESSAGE_ID)); - assertEquals("6a1559560f67c5e7a7d5d838bf0272ee", resultExchange.getIn().getHeader(SqsConstants.MD5_OF_BODY)); - } - - @Test - public void sendInOut() throws Exception { - result.expectedMessageCount(1); - - Exchange exchange = template.send("direct:start", ExchangePattern.InOut, new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody("This is my message text."); - } - }); - - assertMockEndpointsSatisfied(); - - Exchange resultExchange = result.getExchanges().get(0); - assertEquals("This is my message text.", resultExchange.getIn().getBody()); - assertNotNull(resultExchange.getIn().getHeader(SqsConstants.RECEIPT_HANDLE)); - assertNotNull(resultExchange.getIn().getHeader(SqsConstants.MESSAGE_ID)); - assertEquals("6a1559560f67c5e7a7d5d838bf0272ee", resultExchange.getIn().getHeader(SqsConstants.MD5_OF_BODY)); - assertNotNull(resultExchange.getIn().getHeader(SqsConstants.ATTRIBUTES)); - - assertNotNull(exchange.getOut().getHeader(SqsConstants.MESSAGE_ID)); - assertEquals("6a1559560f67c5e7a7d5d838bf0272ee", exchange.getOut().getHeader(SqsConstants.MD5_OF_BODY)); - } - - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsTestSupport.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsTestSupport.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsTestSupport.java deleted file mode 100644 index 71ca810..0000000 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsTestSupport.java +++ /dev/null @@ -1,40 +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. - */ - -package org.apache.camel.itest.osgi.aws; - -import org.apache.camel.itest.osgi.OSGiIntegrationSpringTestSupport; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; - -import static org.ops4j.pax.exam.OptionUtils.combine; - - -public abstract class AwsTestSupport extends OSGiIntegrationSpringTestSupport { - - - @Configuration - public static Option[] configure() { - Option[] options = combine( - getDefaultCamelKarafOptions(), - // using the features to install the other camel components - loadCamelFeatures("camel-aws")); - - return options; - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/base64/Base64Test.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/base64/Base64Test.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/base64/Base64Test.java deleted file mode 100644 index c2ce431..0000000 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/base64/Base64Test.java +++ /dev/null @@ -1,190 +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. - */ -package org.apache.camel.itest.osgi.base64; - -import org.apache.camel.EndpointInject; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.dataformat.base64.Base64DataFormat; -import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.junit.PaxExam; - -import static org.ops4j.pax.exam.OptionUtils.combine; - - -@RunWith(PaxExam.class) -public class Base64Test extends OSGiIntegrationTestSupport { - - private static final String ENCODED = "IrRWhNZNjFxQ6WXJEIsehbnFdurtgacAq+t6Zh3uYlyclF3HAx995mbIydQlymM8V3yA+Yb1p3Ij\r\n" - + "7AS1VQaUNHAljNpHUqrWR6EmASZV/EQvR5Gk8XDvRrrtkoDm+jdZ/XKfest2OIzhixZF1mcqyi1P\r\n" - + "Hep/rFnVPclO9WOWtCCRhz+U2soBzNBtvTc6x1pz1gOZcoOEFKHSf2kmkq1/7hHFl5Cb9nbSBgyp\r\n" - + "lFzsInVBfCkRxXAFixwbC3B+LB8e15zSMvoG6okyDs7C8QShIZCXGHlsuUiH96izUbfB8qpTQK80\r\n" - + "PPAisxYhF/gb678wvO5e/03AmFmYbBqzwoNQ6PoZKFI8a4PUrLoCLrUnKQgwOXueb1y8d4bsVGrX\r\n" - + "H5QUFgAE3yZEn2ZQtVv6bZnm3lvBe/LLRD4xIU2Pcm5e+DJUZhHcl/8MaioDWFgYPLftDKvEUwLB\r\n" - + "3IFWLSKMKFoeXn2nkwxsCHrzhajhbkKl1+H9I7Gkd19DyAoPIriWOJScog+mcP0iqG9iMqYFko2n\r\n" - + "rh2rr+jcyKFBhrRUuNw3W8+h+FOwZDLcBmuTv2lEOvUdaPgD+1e6fXpuxhiih4wf/zlakeVa031T\r\n" - + "9c0/HN02z0cAhLT1vtEA0zDn6OzzhY//Mh332ZmC+xro+e9o2a6+dnwamDtLuRgDDd+EcoUQpfEL\r\n" - + "XobX3ZSX7OQw1ZXxWiJLtSOc5yLRkdbxdLK/C6fkcY4cqc/RwBGYtXN7Z1ENG/s/LnrZnRU/ErMW\r\n" - + "RtbRwehA/0a2KSbNOMwK8BpzDruXufLXZcGaDKRUektQfdX4XhhYESt1drewlQLVaEWrZBR8JOd5\r\n" - + "mckulPhwHp2Q00YyoScEj6Rs/9siyv49/FSaRCbnfzl3CRnNvCOD1cvF4OneYbVJCMOY49ucFmN/\r\n" - + "mBCyxLOtJ4Zz8EG1FC81QTg3Scw+FdFDsCgr7DqVrmPOLikqq6wJdLBjyHXuMiVP9Fq/aAxvXEgj\r\n" - + "RuVnN20wn2tUOXeaN4XqziQ66M229HsY0BX5riJ00yXArDxd+I9mFDpw/UDnGBAE2P//1fU1ns1A\r\n" - + "6zQ6hTv7axdlw3/FnOAdymEKqED9CPfbiDvJygcAcxv2fyORHQ+TiprMGxckAlnLZ2pGl+gOzbtZ\r\n" - + "zJgecyFJHBbhtkubGD4zzQhuJJw8ypqppSxqDs8SAW2frj42UT9qRMeCBGXLa1wyISt4GI6iOnfw\r\n" - + "TCRJ/SE7CVrEfmdmROlJpAJHfUlQIJq1aW3mTE5zTmAygypxRUDCmA+eY9wdCicFp6YptdCEK3P2\r\n" - + "7QzZsSASAByd5jxHMiIBkdwGzj1501xZ7hFLJDXDTQ==\r\n"; - - private static final byte[] DECODED = { - 34, -76, 86, -124, -42, 77, -116, - 92, 80, -23, 101, -55, 16, -117, 30, -123, -71, -59, 118, -22, -19, - -127, -89, 0, -85, -21, 122, 102, 29, -18, 98, 92, -100, -108, 93, - -57, 3, 31, 125, -26, 102, -56, -55, -44, 37, -54, 99, 60, 87, 124, - -128, -7, -122, -11, -89, 114, 35, -20, 4, -75, 85, 6, -108, 52, - 112, 37, -116, -38, 71, 82, -86, -42, 71, -95, 38, 1, 38, 85, -4, - 68, 47, 71, -111, -92, -15, 112, -17, 70, -70, -19, -110, -128, - -26, -6, 55, 89, -3, 114, -97, 122, -53, 118, 56, -116, -31, -117, - 22, 69, -42, 103, 42, -54, 45, 79, 29, -22, 127, -84, 89, -43, 61, - -55, 78, -11, 99, -106, -76, 32, -111, -121, 63, -108, -38, -54, 1, - -52, -48, 109, -67, 55, 58, -57, 90, 115, -42, 3, -103, 114, -125, - -124, 20, -95, -46, 127, 105, 38, -110, -83, 127, -18, 17, -59, - -105, -112, -101, -10, 118, -46, 6, 12, -87, -108, 92, -20, 34, - 117, 65, 124, 41, 17, -59, 112, 5, -117, 28, 27, 11, 112, 126, 44, - 31, 30, -41, -100, -46, 50, -6, 6, -22, -119, 50, 14, -50, -62, - -15, 4, -95, 33, -112, -105, 24, 121, 108, -71, 72, -121, -9, -88, - -77, 81, -73, -63, -14, -86, 83, 64, -81, 52, 60, -16, 34, -77, 22, - 33, 23, -8, 27, -21, -65, 48, -68, -18, 94, -1, 77, -64, -104, 89, - -104, 108, 26, -77, -62, -125, 80, -24, -6, 25, 40, 82, 60, 107, - -125, -44, -84, -70, 2, 46, -75, 39, 41, 8, 48, 57, 123, -98, 111, - 92, -68, 119, -122, -20, 84, 106, -41, 31, -108, 20, 22, 0, 4, -33, - 38, 68, -97, 102, 80, -75, 91, -6, 109, -103, -26, -34, 91, -63, - 123, -14, -53, 68, 62, 49, 33, 77, -113, 114, 110, 94, -8, 50, 84, - 102, 17, -36, -105, -1, 12, 106, 42, 3, 88, 88, 24, 60, -73, -19, - 12, -85, -60, 83, 2, -63, -36, -127, 86, 45, 34, -116, 40, 90, 30, - 94, 125, -89, -109, 12, 108, 8, 122, -13, -123, -88, -31, 110, 66, - -91, -41, -31, -3, 35, -79, -92, 119, 95, 67, -56, 10, 15, 34, -72, - -106, 56, -108, -100, -94, 15, -90, 112, -3, 34, -88, 111, 98, 50, - -90, 5, -110, -115, -89, -82, 29, -85, -81, -24, -36, -56, -95, 65, - -122, -76, 84, -72, -36, 55, 91, -49, -95, -8, 83, -80, 100, 50, - -36, 6, 107, -109, -65, 105, 68, 58, -11, 29, 104, -8, 3, -5, 87, - -70, 125, 122, 110, -58, 24, -94, -121, -116, 31, -1, 57, 90, -111, - -27, 90, -45, 125, 83, -11, -51, 63, 28, -35, 54, -49, 71, 0, -124, - -76, -11, -66, -47, 0, -45, 48, -25, -24, -20, -13, -123, -113, -1, - 50, 29, -9, -39, -103, -126, -5, 26, -24, -7, -17, 104, -39, -82, - -66, 118, 124, 26, -104, 59, 75, -71, 24, 3, 13, -33, -124, 114, - -123, 16, -91, -15, 11, 94, -122, -41, -35, -108, -105, -20, -28, - 48, -43, -107, -15, 90, 34, 75, -75, 35, -100, -25, 34, -47, -111, - -42, -15, 116, -78, -65, 11, -89, -28, 113, -114, 28, -87, -49, - -47, -64, 17, -104, -75, 115, 123, 103, 81, 13, 27, -5, 63, 46, - 122, -39, -99, 21, 63, 18, -77, 22, 70, -42, -47, -63, -24, 64, -1, - 70, -74, 41, 38, -51, 56, -52, 10, -16, 26, 115, 14, -69, -105, - -71, -14, -41, 101, -63, -102, 12, -92, 84, 122, 75, 80, 125, -43, - -8, 94, 24, 88, 17, 43, 117, 118, -73, -80, -107, 2, -43, 104, 69, - -85, 100, 20, 124, 36, -25, 121, -103, -55, 46, -108, -8, 112, 30, - -99, -112, -45, 70, 50, -95, 39, 4, -113, -92, 108, -1, -37, 34, - -54, -2, 61, -4, 84, -102, 68, 38, -25, 127, 57, 119, 9, 25, -51, - -68, 35, -125, -43, -53, -59, -32, -23, -34, 97, -75, 73, 8, -61, - -104, -29, -37, -100, 22, 99, 127, -104, 16, -78, -60, -77, -83, - 39, -122, 115, -16, 65, -75, 20, 47, 53, 65, 56, 55, 73, -52, 62, - 21, -47, 67, -80, 40, 43, -20, 58, -107, -82, 99, -50, 46, 41, 42, - -85, -84, 9, 116, -80, 99, -56, 117, -18, 50, 37, 79, -12, 90, -65, - 104, 12, 111, 92, 72, 35, 70, -27, 103, 55, 109, 48, -97, 107, 84, - 57, 119, -102, 55, -123, -22, -50, 36, 58, -24, -51, -74, -12, 123, - 24, -48, 21, -7, -82, 34, 116, -45, 37, -64, -84, 60, 93, -8, -113, - 102, 20, 58, 112, -3, 64, -25, 24, 16, 4, -40, -1, -1, -43, -11, - 53, -98, -51, 64, -21, 52, 58, -123, 59, -5, 107, 23, 101, -61, - 127, -59, -100, -32, 29, -54, 97, 10, -88, 64, -3, 8, -9, -37, - -120, 59, -55, -54, 7, 0, 115, 27, -10, 127, 35, -111, 29, 15, - -109, -118, -102, -52, 27, 23, 36, 2, 89, -53, 103, 106, 70, -105, - -24, 14, -51, -69, 89, -52, -104, 30, 115, 33, 73, 28, 22, -31, - -74, 75, -101, 24, 62, 51, -51, 8, 110, 36, -100, 60, -54, -102, - -87, -91, 44, 106, 14, -49, 18, 1, 109, -97, -82, 62, 54, 81, 63, - 106, 68, -57, -126, 4, 101, -53, 107, 92, 50, 33, 43, 120, 24, - -114, -94, 58, 119, -16, 76, 36, 73, -3, 33, 59, 9, 90, -60, 126, - 103, 102, 68, -23, 73, -92, 2, 71, 125, 73, 80, 32, -102, -75, 105, - 109, -26, 76, 78, 115, 78, 96, 50, -125, 42, 113, 69, 64, -62, - -104, 15, -98, 99, -36, 29, 10, 39, 5, -89, -90, 41, -75, -48, - -124, 43, 115, -10, -19, 12, -39, -79, 32, 18, 0, 28, -99, -26, 60, - 71, 50, 34, 1, -111, -36, 6, -50, 61, 121, -45, 92, 89, -18, 17, - 75, 36, 53, -61, 77 }; - - public Base64DataFormat format = new Base64DataFormat(); - - @EndpointInject(uri = "mock:result") - private MockEndpoint result; - - public void runEncoderTest(byte[] raw, byte[] expected) throws Exception { - result.setExpectedMessageCount(1); - - template.sendBody("direct:startEncode", raw); - - assertMockEndpointsSatisfied(); - - byte[] encoded = result.getReceivedExchanges().get(0).getIn() - .getBody(byte[].class); - assertArrayEquals(expected, encoded); - } - - public void runDecoderTest(byte[] encoded, byte[] expected) - throws Exception { - result.setExpectedMessageCount(1); - - template.sendBody("direct:startDecode", encoded); - - assertMockEndpointsSatisfied(); - - byte[] decoded = result.getReceivedExchanges().get(0).getIn() - .getBody(byte[].class); - assertArrayEquals(expected, decoded); - } - - @Test - public void testEncode() throws Exception { - runEncoderTest(DECODED, ENCODED.getBytes()); - } - - @Test - public void testDecode() throws Exception { - runDecoderTest(ENCODED.getBytes(), DECODED); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - - @Override - public void configure() throws Exception { - from("direct:startEncode").marshal(format).to("mock:result"); - - from("direct:startDecode").unmarshal(format).to("mock:result"); - } - }; - } - - @Configuration - public static Option[] configure() { - Option[] options = combine(getDefaultCamelKarafOptions(), - loadCamelFeatures("camel-base64")); - - return options; - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/BeanValidatorTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/BeanValidatorTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/BeanValidatorTest.java deleted file mode 100644 index d106b5a..0000000 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/BeanValidatorTest.java +++ /dev/null @@ -1,69 +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. - */ - -package org.apache.camel.itest.osgi.bean.validator; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.junit.PaxExam; - -import static org.ops4j.pax.exam.OptionUtils.combine; - -@RunWith(PaxExam.class) -public class BeanValidatorTest extends OSGiIntegrationTestSupport { - - @Test - public void testBeanValidatorRoute() throws Exception { - Exchange exchange = template.request("bean-validator://x", new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody(createCar("BMW", "DD-AB-123")); - } - }); - - assertNotNull(exchange); - } - - @Test - public void validateShouldSuccessWithExpliciteDefaultGroup() throws Exception { - Exchange exchange = template.request("bean-validator://x?group=javax.validation.groups.Default", new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody(createCar("BMW", "DD-AB-123")); - } - }); - - assertNotNull(exchange); - } - - Car createCar(String manufacturer, String licencePlate) { - return new CarWithAnnotations(manufacturer, licencePlate); - } - - @Configuration - public static Option[] configure() { - Option[] options = combine( - getDefaultCamelKarafOptions(), - // using the features to install the other camel components - loadCamelFeatures("camel-bean-validator")); - - return options; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/Car.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/Car.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/Car.java deleted file mode 100644 index 87bb7eb..0000000 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/Car.java +++ /dev/null @@ -1,29 +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. - */ - -package org.apache.camel.itest.osgi.bean.validator; - -public interface Car { - - String getManufacturer(); - - void setManufacturer(String manufacturer); - - String getLicensePlate(); - - void setLicensePlate(String licensePlate); -} http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithAnnotations.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithAnnotations.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithAnnotations.java deleted file mode 100644 index 440cbe2..0000000 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithAnnotations.java +++ /dev/null @@ -1,53 +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. - */ - -package org.apache.camel.itest.osgi.bean.validator; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - - -public class CarWithAnnotations implements Car { - - @NotNull - private String manufacturer; - - @NotNull - @Size(min = 5, max = 14, groups = OptionalChecks.class) - private String licensePlate; - - public CarWithAnnotations(String manufacturer, String licencePlate) { - this.manufacturer = manufacturer; - this.licensePlate = licencePlate; - } - - public String getManufacturer() { - return manufacturer; - } - - public void setManufacturer(String manufacturer) { - this.manufacturer = manufacturer; - } - - public String getLicensePlate() { - return licensePlate; - } - - public void setLicensePlate(String licensePlate) { - this.licensePlate = licensePlate; - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithoutAnnotations.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithoutAnnotations.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithoutAnnotations.java deleted file mode 100644 index 229382d..0000000 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/CarWithoutAnnotations.java +++ /dev/null @@ -1,46 +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. - */ - -package org.apache.camel.itest.osgi.bean.validator; - -public class CarWithoutAnnotations implements Car { - - private String manufacturer; - - private String licensePlate; - - public CarWithoutAnnotations(String manufacturer, String licencePlate) { - this.manufacturer = manufacturer; - this.licensePlate = licencePlate; - } - - public String getManufacturer() { - return manufacturer; - } - - public void setManufacturer(String manufacturer) { - this.manufacturer = manufacturer; - } - - public String getLicensePlate() { - return licensePlate; - } - - public void setLicensePlate(String licensePlate) { - this.licensePlate = licensePlate; - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/OptionalChecks.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/OptionalChecks.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/OptionalChecks.java deleted file mode 100644 index c9b72d7..0000000 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bean/validator/OptionalChecks.java +++ /dev/null @@ -1,21 +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. - */ - -package org.apache.camel.itest.osgi.bean.validator; - -public interface OptionalChecks { -} http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/beanio/BeanIODataFormatSimpleTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/beanio/BeanIODataFormatSimpleTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/beanio/BeanIODataFormatSimpleTest.java deleted file mode 100644 index ad0feca..0000000 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/beanio/BeanIODataFormatSimpleTest.java +++ /dev/null @@ -1,127 +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. - */ -package org.apache.camel.itest.osgi.beanio; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.List; - -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.dataformat.beanio.BeanIODataFormat; -import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport; -import org.apache.camel.spi.DataFormat; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.junit.PaxExam; - -import static org.ops4j.pax.exam.OptionUtils.combine; - -/** - * - */ -@RunWith(PaxExam.class) -public class BeanIODataFormatSimpleTest extends OSGiIntegrationTestSupport { - - private static final String FIXED_DATA = "Joe,Smith,Developer,75000,10012009" + LS - + "Jane,Doe,Architect,80000,01152008" + LS - + "Jon,Anderson,Manager,85000,03182007" + LS; - - @Test - public void testMarshal() throws Exception { - List<Employee> employees = getEmployees(); - - MockEndpoint mock = getMockEndpoint("mock:beanio-marshal"); - mock.expectedBodiesReceived(FIXED_DATA); - - template.sendBody("direct:marshal", employees); - - mock.assertIsSatisfied(); - } - - @Test - public void testUnmarshal() throws Exception { - List<Employee> employees = getEmployees(); - - MockEndpoint mock = getMockEndpoint("mock:beanio-unmarshal"); - mock.expectedBodiesReceived(employees); - - template.sendBody("direct:unmarshal", FIXED_DATA); - - mock.assertIsSatisfied(); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - DataFormat format = new BeanIODataFormat( - "org/apache/camel/itest/osgi/beanio/mappings.xml", - "employeeFile"); - - from("direct:unmarshal").unmarshal(format) - .split(simple("body")).to("mock:beanio-unmarshal"); - - from("direct:marshal").marshal(format) - .to("mock:beanio-marshal"); - } - }; - } - - private List<Employee> getEmployees() throws ParseException { - List<Employee> employees = new ArrayList<Employee>(); - Employee one = new Employee(); - one.setFirstName("Joe"); - one.setLastName("Smith"); - one.setTitle("Developer"); - one.setSalary(75000); - one.setHireDate(new SimpleDateFormat("MMddyyyy").parse("10012009")); - employees.add(one); - - Employee two = new Employee(); - two.setFirstName("Jane"); - two.setLastName("Doe"); - two.setTitle("Architect"); - two.setSalary(80000); - two.setHireDate(new SimpleDateFormat("MMddyyyy").parse("01152008")); - employees.add(two); - - Employee three = new Employee(); - three.setFirstName("Jon"); - three.setLastName("Anderson"); - three.setTitle("Manager"); - three.setSalary(85000); - three.setHireDate(new SimpleDateFormat("MMddyyyy").parse("03182007")); - employees.add(three); - return employees; - } - - @Configuration - public static Option[] configure() { - Option[] options = combine( - getDefaultCamelKarafOptions(), - // using the features to install the other camel components - loadCamelFeatures("camel-beanio")); - - return options; - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/beanio/Employee.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/beanio/Employee.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/beanio/Employee.java deleted file mode 100644 index 352c3bc..0000000 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/beanio/Employee.java +++ /dev/null @@ -1,104 +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. - */ -package org.apache.camel.itest.osgi.beanio; - -import java.util.Date; - -/** - * - */ -public class Employee { - - private String firstName; - private String lastName; - private String title; - private int salary; - private Date hireDate; - - public Employee() { - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public int getSalary() { - return salary; - } - - public void setSalary(int salary) { - this.salary = salary; - } - - public Date getHireDate() { - return hireDate; - } - - public void setHireDate(Date hireDate) { - this.hireDate = hireDate; - } - - @Override - public int hashCode() { - int result = firstName != null ? firstName.hashCode() : 0; - result = 31 * result + (lastName != null ? lastName.hashCode() : 0); - result = 31 * result + (title != null ? title.hashCode() : 0); - result = 31 * result + salary; - result = 31 * result + (hireDate != null ? hireDate.hashCode() : 0); - return result; - } - - @Override - public boolean equals(Object object) { - if (object == null) { - return false; - } else if (object == this) { - return true; - } else if (!(object instanceof Employee)) { - return false; - } - - Employee e = (Employee) object; - - return this.getFirstName().equals(e.getFirstName()) - && this.getLastName().equals(e.getLastName()) - && this.getTitle().equals(e.getTitle()) - && this.getSalary() == e.getSalary() - && this.getHireDate().equals(e.getHireDate()); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bindy/BindyDataFormatCsvTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bindy/BindyDataFormatCsvTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bindy/BindyDataFormatCsvTest.java deleted file mode 100644 index 65bccfd..0000000 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bindy/BindyDataFormatCsvTest.java +++ /dev/null @@ -1,125 +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. - */ -package org.apache.camel.itest.osgi.bindy; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.List; - -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat; -import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport; -import org.apache.camel.spi.DataFormat; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.junit.PaxExam; - -import static org.ops4j.pax.exam.OptionUtils.combine; - -/** - * - */ -@RunWith(PaxExam.class) -public class BindyDataFormatCsvTest extends OSGiIntegrationTestSupport { - - private static final String FIXED_DATA = "Joe,Smith,Developer,75000,10012009" + "\n" - + "Jane,Doe,Architect,80000,01152008" + "\n" - + "Jon,Anderson,Manager,85000,03182007" + "\n"; - - @Test - public void testMarshal() throws Exception { - List<Employee> employees = getEmployees(); - - MockEndpoint mock = getMockEndpoint("mock:bindy-marshal"); - mock.expectedBodiesReceived(FIXED_DATA); - - template.sendBody("direct:marshal", employees); - - mock.assertIsSatisfied(); - } - - @Test - public void testUnmarshal() throws Exception { - List<Employee> employees = getEmployees(); - - MockEndpoint mock = getMockEndpoint("mock:bindy-unmarshal"); - mock.expectedBodiesReceived(employees); - - template.sendBody("direct:unmarshal", FIXED_DATA); - - mock.assertIsSatisfied(); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - DataFormat format = new BindyCsvDataFormat(Employee.class); - - from("direct:unmarshal").unmarshal(format) - .split(simple("body")).to("mock:bindy-unmarshal"); - - from("direct:marshal").marshal(format) - .to("mock:bindy-marshal"); - } - }; - } - - private List<Employee> getEmployees() throws ParseException { - List<Employee> employees = new ArrayList<Employee>(); - Employee one = new Employee(); - one.setFirstName("Joe"); - one.setLastName("Smith"); - one.setTitle("Developer"); - one.setSalary(75000); - one.setHireDate(new SimpleDateFormat("MMddyyyy").parse("10012009")); - employees.add(one); - - Employee two = new Employee(); - two.setFirstName("Jane"); - two.setLastName("Doe"); - two.setTitle("Architect"); - two.setSalary(80000); - two.setHireDate(new SimpleDateFormat("MMddyyyy").parse("01152008")); - employees.add(two); - - Employee three = new Employee(); - three.setFirstName("Jon"); - three.setLastName("Anderson"); - three.setTitle("Manager"); - three.setSalary(85000); - three.setHireDate(new SimpleDateFormat("MMddyyyy").parse("03182007")); - employees.add(three); - return employees; - } - - @Configuration - public static Option[] configure() { - Option[] options = combine( - getDefaultCamelKarafOptions(), - // using the features to install the other camel components - loadCamelFeatures("camel-bindy")); - - return options; - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bindy/BindySpringDataFormatCsvJavaRouteTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bindy/BindySpringDataFormatCsvJavaRouteTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bindy/BindySpringDataFormatCsvJavaRouteTest.java deleted file mode 100644 index 8addfe5..0000000 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bindy/BindySpringDataFormatCsvJavaRouteTest.java +++ /dev/null @@ -1,112 +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. - */ -package org.apache.camel.itest.osgi.bindy; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.List; - -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.itest.osgi.OSGiIntegrationSpringTestSupport; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.junit.PaxExam; -import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext; - -import static org.ops4j.pax.exam.OptionUtils.combine; - -/** - * - */ -@RunWith(PaxExam.class) -public class BindySpringDataFormatCsvJavaRouteTest extends OSGiIntegrationSpringTestSupport { - - private static final String FIXED_DATA = "Joe,Smith,Developer,75000,10012009" + "\n" - + "Jane,Doe,Architect,80000,01152008" + "\n" - + "Jon,Anderson,Manager,85000,03182007" + "\n"; - - @Test - public void testMarshal() throws Exception { - List<Employee> employees = getEmployees(); - - MockEndpoint mock = getMockEndpoint("mock:bindy-marshal"); - mock.expectedBodiesReceived(FIXED_DATA); - - template.sendBody("direct:marshal", employees); - - mock.assertIsSatisfied(); - } - - @Test - public void testUnmarshal() throws Exception { - List<Employee> employees = getEmployees(); - - MockEndpoint mock = getMockEndpoint("mock:bindy-unmarshal"); - mock.expectedBodiesReceived(employees); - - template.sendBody("direct:unmarshal", FIXED_DATA); - - mock.assertIsSatisfied(); - } - - @Override - protected OsgiBundleXmlApplicationContext createApplicationContext() { - return new OsgiBundleXmlApplicationContext(new String[]{"org/apache/camel/itest/osgi/bindy/BindySpringDataFormatCsvTest.xml"}); - } - - private List<Employee> getEmployees() throws ParseException { - List<Employee> employees = new ArrayList<Employee>(); - Employee one = new Employee(); - one.setFirstName("Joe"); - one.setLastName("Smith"); - one.setTitle("Developer"); - one.setSalary(75000); - one.setHireDate(new SimpleDateFormat("MMddyyyy").parse("10012009")); - employees.add(one); - - Employee two = new Employee(); - two.setFirstName("Jane"); - two.setLastName("Doe"); - two.setTitle("Architect"); - two.setSalary(80000); - two.setHireDate(new SimpleDateFormat("MMddyyyy").parse("01152008")); - employees.add(two); - - Employee three = new Employee(); - three.setFirstName("Jon"); - three.setLastName("Anderson"); - three.setTitle("Manager"); - three.setSalary(85000); - three.setHireDate(new SimpleDateFormat("MMddyyyy").parse("03182007")); - employees.add(three); - return employees; - } - - @Configuration - public static Option[] configure() { - Option[] options = combine( - getDefaultCamelKarafOptions(), - // using the features to install the other camel components - loadCamelFeatures("camel-bindy")); - - return options; - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bindy/BindySpringDataFormatCsvTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bindy/BindySpringDataFormatCsvTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bindy/BindySpringDataFormatCsvTest.java deleted file mode 100644 index 514b466..0000000 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bindy/BindySpringDataFormatCsvTest.java +++ /dev/null @@ -1,112 +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. - */ -package org.apache.camel.itest.osgi.bindy; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.List; - -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.itest.osgi.OSGiIntegrationSpringTestSupport; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.junit.PaxExam; -import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext; - -import static org.ops4j.pax.exam.OptionUtils.combine; - -/** - * - */ -@RunWith(PaxExam.class) -public class BindySpringDataFormatCsvTest extends OSGiIntegrationSpringTestSupport { - - private static final String FIXED_DATA = "Joe,Smith,Developer,75000,10012009" + "\n" - + "Jane,Doe,Architect,80000,01152008" + "\n" - + "Jon,Anderson,Manager,85000,03182007" + "\n"; - - @Test - public void testMarshal() throws Exception { - List<Employee> employees = getEmployees(); - - MockEndpoint mock = getMockEndpoint("mock:bindy-marshal"); - mock.expectedBodiesReceived(FIXED_DATA); - - template.sendBody("direct:marshal", employees); - - mock.assertIsSatisfied(); - } - - @Test - public void testUnmarshal() throws Exception { - List<Employee> employees = getEmployees(); - - MockEndpoint mock = getMockEndpoint("mock:bindy-unmarshal"); - mock.expectedBodiesReceived(employees); - - template.sendBody("direct:unmarshal", FIXED_DATA); - - mock.assertIsSatisfied(); - } - - @Override - protected OsgiBundleXmlApplicationContext createApplicationContext() { - return new OsgiBundleXmlApplicationContext(new String[]{"org/apache/camel/itest/osgi/bindy/BindySpringDataFormatCsvTest.xml"}); - } - - private List<Employee> getEmployees() throws ParseException { - List<Employee> employees = new ArrayList<Employee>(); - Employee one = new Employee(); - one.setFirstName("Joe"); - one.setLastName("Smith"); - one.setTitle("Developer"); - one.setSalary(75000); - one.setHireDate(new SimpleDateFormat("MMddyyyy").parse("10012009")); - employees.add(one); - - Employee two = new Employee(); - two.setFirstName("Jane"); - two.setLastName("Doe"); - two.setTitle("Architect"); - two.setSalary(80000); - two.setHireDate(new SimpleDateFormat("MMddyyyy").parse("01152008")); - employees.add(two); - - Employee three = new Employee(); - three.setFirstName("Jon"); - three.setLastName("Anderson"); - three.setTitle("Manager"); - three.setSalary(85000); - three.setHireDate(new SimpleDateFormat("MMddyyyy").parse("03182007")); - employees.add(three); - return employees; - } - - @Configuration - public static Option[] configure() { - Option[] options = combine( - getDefaultCamelKarafOptions(), - // using the features to install the other camel components - loadCamelFeatures("camel-bindy")); - - return options; - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bindy/Employee.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bindy/Employee.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bindy/Employee.java deleted file mode 100644 index 6c4bd34..0000000 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/bindy/Employee.java +++ /dev/null @@ -1,113 +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. - */ -package org.apache.camel.itest.osgi.bindy; - -import java.util.Date; - -import org.apache.camel.dataformat.bindy.annotation.CsvRecord; -import org.apache.camel.dataformat.bindy.annotation.DataField; - -/** - * - */ -@CsvRecord(name = "Employee", crlf = "UNIX", separator = ",") -public class Employee { - - @DataField(pos = 1) - private String firstName; - @DataField(pos = 2) - private String lastName; - @DataField(pos = 3) - private String title; - @DataField(pos = 4) - private int salary; - @DataField(pos = 5, pattern = "MMddyyyy") - private Date hireDate; - - public Employee() { - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public int getSalary() { - return salary; - } - - public void setSalary(int salary) { - this.salary = salary; - } - - public Date getHireDate() { - return hireDate; - } - - public void setHireDate(Date hireDate) { - this.hireDate = hireDate; - } - - @Override - public int hashCode() { - int result = firstName != null ? firstName.hashCode() : 0; - result = 31 * result + (lastName != null ? lastName.hashCode() : 0); - result = 31 * result + (title != null ? title.hashCode() : 0); - result = 31 * result + salary; - result = 31 * result + (hireDate != null ? hireDate.hashCode() : 0); - return result; - } - - @Override - public boolean equals(Object object) { - if (object == null) { - return false; - } else if (object == this) { - return true; - } else if (!(object instanceof Employee)) { - return false; - } - - Employee e = (Employee) object; - - return this.getFirstName().equals(e.getFirstName()) - && this.getLastName().equals(e.getLastName()) - && this.getTitle().equals(e.getTitle()) - && this.getSalary() == e.getSalary() - && this.getHireDate().equals(e.getHireDate()); - } - -}