You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/04/18 13:40:16 UTC
[10/20] camel git commit: Delete all the old karaf osgi tests that do
not work. We should use the new camel-test-karaf module as base for testing.
http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/http4/Http4Test.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/http4/Http4Test.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/http4/Http4Test.java
deleted file mode 100644
index 8f2d09d..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/http4/Http4Test.java
+++ /dev/null
@@ -1,76 +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.http4;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
-import org.junit.Ignore;
-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 Http4Test extends OSGiIntegrationTestSupport {
-
- @Test
- public void testHttp4Get() throws Exception {
- String reply = template.requestBody("http4://localhost:9081/foo", null, String.class);
- assertEquals("Bye World", reply);
- }
-
- @Test
- public void testHttp4Post() throws Exception {
- String reply = template.requestBody("http4://localhost:9081/foo", "Hello World", String.class);
- assertEquals("Bye World", reply);
- }
-
- @Test
- @Ignore("Requires online internet for testing")
- public void testHttp4Google() throws Exception {
- String reply = template.requestBody("http4://www.google.se", null, String.class);
- assertNotNull(reply);
- log.info(reply);
- }
-
- protected RouteBuilder createRouteBuilder() {
- return new RouteBuilder() {
- public void configure() {
- from("jetty:http://0.0.0.0:9081/foo")
- .transform(constant("Bye World"));
- }
- };
- }
-
- @Configuration
- public static Option[] configure() {
- Option[] options = combine(
- getDefaultCamelKarafOptions(),
- // using the features to install the other camel components
- loadCamelFeatures("camel-http4", "camel-jetty"));
-
- 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/jasypt/JasyptTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jasypt/JasyptTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jasypt/JasyptTest.java
deleted file mode 100644
index a9c9e51..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jasypt/JasyptTest.java
+++ /dev/null
@@ -1,72 +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.jasypt;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.jasypt.JasyptPropertiesParser;
-import org.apache.camel.component.properties.PropertiesComponent;
-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 JasyptTest extends OSGiIntegrationTestSupport {
-
- @Test
- public void testJasyptProperties() throws Exception {
- getMockEndpoint("mock:tiger").expectedBodiesReceived("Hello World");
-
- template.sendBody("direct:start", "Hello World");
-
- assertMockEndpointsSatisfied();
- }
-
- protected RouteBuilder createRouteBuilder() {
- // create the jasypt properties parser
- JasyptPropertiesParser jasypt = new JasyptPropertiesParser();
- // and set the master password
- jasypt.setPassword("secret");
-
- // configure the properties component
- PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
- pc.setLocation("classpath:org/apache/camel/itest/osgi/jasypt/myproperties.properties");
- // and use the jasypt properties parser so we can decrypt values
- pc.setPropertiesParser(jasypt);
-
- return new RouteBuilder() {
- public void configure() {
- from("direct:start").to("{{cool.result}}");
- }
- };
- }
-
- @Configuration
- public static Option[] configure() {
- Option[] options = combine(
- getDefaultCamelKarafOptions(),
- // using the features to install the other camel components
- loadCamelFeatures("camel-jasypt"));
-
- 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/jaxb/JaxbDataFormatTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/JaxbDataFormatTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/JaxbDataFormatTest.java
deleted file mode 100644
index 0291b8b..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/JaxbDataFormatTest.java
+++ /dev/null
@@ -1,76 +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.jaxb;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.converter.jaxb.JaxbDataFormat;
-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 JaxbDataFormatTest extends OSGiIntegrationTestSupport {
-
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() {
- JaxbDataFormat person = new JaxbDataFormat("org.apache.camel.itest.osgi.jaxb");
- from("direct:start").unmarshal(person).to("mock:bar");
- }
- };
- }
-
- @Override
- protected CamelContext createCamelContext() throws Exception {
- CamelContext context = super.createCamelContext();
- context.setApplicationContextClassLoader(this.getClass().getClassLoader());
- return context;
- }
-
- @Test
- public void testSendMessage() throws Exception {
- MockEndpoint mock = getMandatoryEndpoint("mock:bar", MockEndpoint.class);
- assertNotNull("The mock endpoint should not be null", mock);
-
- PersonType expected = new PersonType();
- expected.setFirstName("FOO");
- expected.setLastName("BAR");
- mock.expectedBodiesReceived(expected);
- mock.expectedHeaderReceived("foo", "bar");
- template.sendBodyAndHeader("direct:start", "<Person><firstName>FOO</firstName><lastName>BAR</lastName></Person>",
- "foo", "bar");
- assertMockEndpointsSatisfied();
- }
-
- @Configuration
- public static Option[] configure() {
- Option[] options = combine(
- getDefaultCamelKarafOptions(),
- // using the features to install the other camel components
- loadCamelFeatures("camel-jaxb"));
-
- 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/jaxb/JaxbFallbackConverterSpringTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/JaxbFallbackConverterSpringTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/JaxbFallbackConverterSpringTest.java
deleted file mode 100644
index 93a7081..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/JaxbFallbackConverterSpringTest.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.jaxb;
-
-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 JaxbFallbackConverterSpringTest extends OSGiIntegrationSpringTestSupport {
-
- @Override
- protected OsgiBundleXmlApplicationContext createApplicationContext() {
- return new OsgiBundleXmlApplicationContext(new String[]{"org/apache/camel/itest/osgi/jaxb/CamelContext.xml"});
- }
-
- @Test
- public void testSendMessage() throws Exception {
- MockEndpoint mock = getMandatoryEndpoint("mock:bar", MockEndpoint.class);
- assertNotNull("The mock endpoint should not be null", mock);
-
- PersonType expected = new PersonType();
- expected.setFirstName("FOO");
- expected.setLastName("BAR");
- mock.expectedBodiesReceived(expected);
- mock.expectedHeaderReceived("foo", "bar");
- template.sendBodyAndHeader("direct:start", "<Person><firstName>FOO</firstName><lastName>BAR</lastName></Person>",
- "foo", "bar");
- assertMockEndpointsSatisfied();
- }
-
- @Configuration
- public static Option[] configure() {
- Option[] options = combine(
- getDefaultCamelKarafOptions(),
- // using the features to install the other camel components
- loadCamelFeatures("camel-jaxb"));
-
- 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/jaxb/JaxbFallbackConverterTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/JaxbFallbackConverterTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/JaxbFallbackConverterTest.java
deleted file mode 100644
index de4f9e5..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/JaxbFallbackConverterTest.java
+++ /dev/null
@@ -1,66 +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.jaxb;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-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 JaxbFallbackConverterTest extends OSGiIntegrationTestSupport {
-
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() {
- from("direct:start").convertBodyTo(PersonType.class).to("mock:bar");
- }
- };
- }
-
- @Test
- public void testSendMessage() throws Exception {
- MockEndpoint mock = getMandatoryEndpoint("mock:bar", MockEndpoint.class);
- assertNotNull("The mock endpoint should not be null", mock);
-
- PersonType expected = new PersonType();
- expected.setFirstName("FOO");
- expected.setLastName("BAR");
- mock.expectedBodiesReceived(expected);
- mock.expectedHeaderReceived("foo", "bar");
- template.sendBodyAndHeader("direct:start", "<Person><firstName>FOO</firstName><lastName>BAR</lastName></Person>",
- "foo", "bar");
- assertMockEndpointsSatisfied();
- }
-
- @Configuration
- public static Option[] configure() {
- Option[] options = combine(
- getDefaultCamelKarafOptions(),
- // using the features to install the other camel components
- loadCamelFeatures("camel-jaxb"));
-
- 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/jaxb/ObjectFactory.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/ObjectFactory.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/ObjectFactory.java
deleted file mode 100644
index b246884..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/ObjectFactory.java
+++ /dev/null
@@ -1,68 +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.jaxb;
-
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.annotation.XmlElementDecl;
-import javax.xml.bind.annotation.XmlRegistry;
-import javax.xml.namespace.QName;
-
-
-/**
- * This object contains factory methods for each
- * Java content interface and Java element interface
- * generated in the org.apache.camel.foo.bar package.
- * <p>An ObjectFactory allows you to programatically
- * construct new instances of the Java representation
- * for XML content. The Java representation of XML
- * content can consist of schema derived interfaces
- * and classes representing the binding of schema
- * type definitions, element declarations and model
- * groups. Factory methods for each of these are
- * provided in this class.
- *
- */
-@XmlRegistry
-public class ObjectFactory {
-
- private final QName personQNAME = new QName("", "Person");
-
- /**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.foo.bar
- *
- */
- public ObjectFactory() {
- }
-
- /**
- * Create an instance of {@link PersonType }
- *
- */
- public PersonType createPersonType() {
- return new PersonType();
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link PersonType }{@code >}}
- */
-
- @XmlElementDecl(namespace = "", name = "Person")
- public JAXBElement<PersonType> createPerson(PersonType value) {
- return new JAXBElement<PersonType>(personQNAME, PersonType.class, null, value);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/PersonType.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/PersonType.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/PersonType.java
deleted file mode 100644
index 09b9215..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/PersonType.java
+++ /dev/null
@@ -1,87 +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.jaxb;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-import org.apache.camel.util.ObjectHelper;
-
-/**
- * <p>Java class for PersonType complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="PersonType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="firstName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="lastName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- */
-@XmlRootElement(name = "Person")
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "PersonType", propOrder = {"firstName", "lastName"})
-public class PersonType {
-
- @XmlElement(required = true)
- protected String firstName;
- @XmlElement(required = true)
- protected String lastName;
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String value) {
- this.firstName = value;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String value) {
- this.lastName = value;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof PersonType) {
- PersonType that = (PersonType)o;
- return ObjectHelper.equal(this.firstName, that.firstName)
- && ObjectHelper.equal(this.lastName, that.lastName);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return firstName.hashCode() + lastName.hashCode() * 100;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jclouds/BlobStoreBlueprintRouteTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jclouds/BlobStoreBlueprintRouteTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jclouds/BlobStoreBlueprintRouteTest.java
deleted file mode 100644
index 6e161a2..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jclouds/BlobStoreBlueprintRouteTest.java
+++ /dev/null
@@ -1,101 +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.jclouds;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.component.jclouds.JcloudsConstants;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.itest.osgi.blueprint.OSGiBlueprintTestSupport;
-import org.jclouds.ContextBuilder;
-import org.jclouds.blobstore.BlobStore;
-import org.jclouds.blobstore.BlobStoreContext;
-
-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.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.Constants;
-
-import static org.ops4j.pax.exam.CoreOptions.provision;
-import static org.ops4j.pax.exam.CoreOptions.workingDirectory;
-import static org.ops4j.pax.exam.OptionUtils.combine;
-
-@RunWith(PaxExam.class)
-public class BlobStoreBlueprintRouteTest extends OSGiBlueprintTestSupport {
-
- private static final String TEST_CONTAINER = "testContainer";
-
- /**
- * Strategy to perform any pre setup, before {@link org.apache.camel.CamelContext} is created
- */
- @Override
- protected void doPreSetup() throws Exception {
- BlobStore blobStore = ContextBuilder.newBuilder("transient").credentials("identity", "credential").buildView(BlobStoreContext.class).getBlobStore();
- blobStore.createContainerInLocation(null, TEST_CONTAINER);
- blobStore.clearContainer(TEST_CONTAINER);
- }
-
- @Test
- public void testProducerAndConsumer() throws Exception {
- getInstalledBundle("CamelBlueprintJcloudsTestBundle").start();
- CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintJcloudsTestBundle)", 20000);
-
- MockEndpoint mock = ctx.getEndpoint("mock:results", MockEndpoint.class);
- ProducerTemplate template = ctx.createProducerTemplate();
- mock.expectedMessageCount(2);
-
- template.sendBodyAndHeader("direct:start", "Test 1", JcloudsConstants.BLOB_NAME, "blob1");
- template.sendBodyAndHeader("direct:start", "Test 2", JcloudsConstants.BLOB_NAME, "blob2");
-
- assertMockEndpointsSatisfied();
-
- template.stop();
- }
-
- @Configuration
- public static Option[] configure() throws Exception {
- Option[] options = combine(
- getDefaultCamelKarafOptions(),
- //Helper.setLogLevel("INFO"),
- provision(TinyBundles.bundle()
- .add("META-INF/persistence.xml", BlobStoreBlueprintRouteTest.class.getResource("/META-INF/persistence.xml"))
- .add("OSGI-INF/blueprint/test.xml", BlobStoreBlueprintRouteTest.class.getResource("blueprintCamelContext.xml"))
- .set(Constants.BUNDLE_SYMBOLICNAME, "CamelBlueprintJcloudsTestBundle")
- .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
- .set("Meta-Persistence", "META-INF/persistence.xml")
- .build()),
-
- bundle(TinyBundles.bundle()
- .add("OSGI-INF/blueprint/test.xml", BlobStoreBlueprintRouteTest.class.getResource("blueprintBlobStoreService.xml"))
- .set(Constants.BUNDLE_SYMBOLICNAME, "org.apache.camel.jclouds.blobstore.service")
- .set(Constants.BUNDLE_VERSION, "1.0.0")
- .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
- .build()).start(),
-
- // using the features to install the camel components
- loadCamelFeatures(
- "camel-blueprint", "camel-jclouds"),
- workingDirectory("target/paxrunner/"));
-
- 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/jclouds/BlobStoreRouteTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jclouds/BlobStoreRouteTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jclouds/BlobStoreRouteTest.java
deleted file mode 100644
index a9e9a0b..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jclouds/BlobStoreRouteTest.java
+++ /dev/null
@@ -1,91 +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.jclouds;
-
-import javax.inject.Inject;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.component.jclouds.JcloudsConstants;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
-import org.apache.camel.spring.SpringCamelContext;
-import org.jclouds.ContextBuilder;
-import org.jclouds.blobstore.BlobStore;
-import org.jclouds.blobstore.BlobStoreContext;
-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.osgi.framework.BundleContext;
-import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext;
-
-import static org.ops4j.pax.exam.OptionUtils.combine;
-
-@RunWith(PaxExam.class)
-public class BlobStoreRouteTest extends OSGiIntegrationTestSupport {
-
- private static final String TEST_CONTAINER = "testContainer";
- protected OsgiBundleXmlApplicationContext applicationContext;
-
- @Inject
- protected BundleContext bundleContext;
-
- /**
- * Strategy to perform any pre setup, before {@link org.apache.camel.CamelContext} is created
- */
- @Override
- protected void doPreSetup() throws Exception {
- BlobStore blobStore = ContextBuilder.newBuilder("transient").credentials("identity", "credential").buildView(BlobStoreContext.class).getBlobStore();
- blobStore.createContainerInLocation(null, TEST_CONTAINER);
- blobStore.clearContainer(TEST_CONTAINER);
- }
-
- @Test
- public void testProducerAndConsumer() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:results");
- mock.expectedMessageCount(2);
- template.sendBodyAndHeader("direct:start", "Test 1", JcloudsConstants.BLOB_NAME, "blob1");
- template.sendBodyAndHeader("direct:start", "Test 2", JcloudsConstants.BLOB_NAME, "blob2");
- assertMockEndpointsSatisfied();
- }
-
-
- @Override
- protected CamelContext createCamelContext() throws Exception {
- setThreadContextClassLoader();
- applicationContext = new OsgiBundleXmlApplicationContext(
- new String[]{"org/apache/camel/itest/osgi/jclouds/springJcloudsRouteContext.xml"});
- if (bundleContext != null) {
- applicationContext.setBundleContext(bundleContext);
- applicationContext.refresh();
- }
- return SpringCamelContext.springCamelContext(applicationContext);
- }
-
-
- @Configuration
- public static Option[] configure() throws Exception {
- Option[] options = combine(
- getDefaultCamelKarafOptions(),
- // using the features to install the camel components
- loadCamelFeatures("camel-jclouds"));
-
- 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/jetty/JettyClassloaderCheckProcessor.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/JettyClassloaderCheckProcessor.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/JettyClassloaderCheckProcessor.java
deleted file mode 100644
index 8821ce6..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/JettyClassloaderCheckProcessor.java
+++ /dev/null
@@ -1,31 +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.jetty;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-
-public class JettyClassloaderCheckProcessor implements Processor {
-
- public void process(Exchange exchange) throws Exception {
- ClassLoader contextCl = exchange.getContext().getApplicationContextClassLoader();
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- String classloaders = contextCl.equals(tccl) + " --- " + contextCl + " --- " + tccl;
- exchange.getOut().setBody(classloaders);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/JettyProcessor.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/JettyProcessor.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/JettyProcessor.java
deleted file mode 100644
index 6da3752..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/JettyProcessor.java
+++ /dev/null
@@ -1,33 +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.jetty;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-
-public class JettyProcessor implements Processor {
- private String prefix;
-
- public void setPrefix(String prefix) {
- this.prefix = prefix;
- }
-
- public void process(Exchange exchange) throws Exception {
- exchange.getOut().setBody(prefix);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/OSGiJettyCamelContextsClassloaderTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/OSGiJettyCamelContextsClassloaderTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/OSGiJettyCamelContextsClassloaderTest.java
deleted file mode 100644
index eb17223..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/OSGiJettyCamelContextsClassloaderTest.java
+++ /dev/null
@@ -1,109 +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.jetty;
-
-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 org.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.Constants;
-
-import static org.ops4j.pax.exam.CoreOptions.provision;
-import static org.ops4j.pax.exam.OptionUtils.combine;
-
-/**
- * CAMEL-5722: Test to verify that routes sitting in different bundles but listening on the same Jetty port,
- * and thus, sharing the same container-wide Jetty Connector, do not share the classloader. The TCCL should
- * be different in each case, as for each route it should be the Classloader of their containing bundle.
- */
-@RunWith(PaxExam.class)
-public class OSGiJettyCamelContextsClassloaderTest extends OSGiIntegrationTestSupport {
-
- @Test
- public void testClassloadersAreCongruent() throws Exception {
- // Wait a while to let all the service started
- Thread.sleep(3000);
- // test context 1
- String endpointURI1 = "http://localhost:9010/camel-context-1/continuation/";
- String response1 = template.requestBody(endpointURI1, "Hello World", String.class);
- System.out.println("Response from Context 1: " + response1);
- assertEquals("Camel Context 1 classloaders unequal", "true", response1.split(" --- ")[0]);
-
- // test context 2
- String endpointURI2 = "http://localhost:9010/camel-context-2/continuation/";
- String response2 = template.requestBody(endpointURI2, "Hello World", String.class);
- System.out.println("Response from Context 2: " + response2);
- assertEquals("Camel Context 2 classloaders unequal", "true", response2.split(" --- ")[0]);
-
- // contexts's both classloaders toString() representation must contain the bundle symbolic ID
- // definition of "both classloaders": the Camel Context classloader and the Thread classloader during processing
- assertTrue(response1.matches(".*CamelContextBundle1.*CamelContextBundle1.*"));
- assertTrue(response2.matches(".*CamelContextBundle2.*CamelContextBundle2.*"));
-
- // Wait a while to let all the service started
- Thread.sleep(3000);
- // test context 1
- endpointURI1 = "http://localhost:9010/camel-context-1/noContinuation/";
- response1 = template.requestBody(endpointURI1, "Hello World", String.class);
- System.out.println("Response from Context 1: " + response1);
- assertEquals("Camel Context 1 classloaders unequal", "true", response1.split(" --- ")[0]);
-
- // test context 2
- endpointURI2 = "http://localhost:9010/camel-context-2/noContinuation/";
- response2 = template.requestBody(endpointURI2, "Hello World", String.class);
- System.out.println("Response from Context 2: " + response2);
- assertEquals("Camel Context 2 classloaders unequal", "true", response2.split(" --- ")[0]);
-
- // contexts's both classloaders toString() representation must contain the bundle symbolic ID
- // definition of "both classloaders": the Camel Context classloader and the Thread classloader during processing
- assertTrue(response1.matches(".*CamelContextBundle1.*CamelContextBundle1.*"));
- assertTrue(response2.matches(".*CamelContextBundle2.*CamelContextBundle2.*"));
-
- }
-
- @Configuration
- public static Option[] configure() {
- Option[] options = combine(
- getDefaultCamelKarafOptions(),
- // using the features to install the other camel components
- loadCamelFeatures("camel-jetty"),
- //set up the camel context bundle1
- provision(TinyBundles.bundle().add("META-INF/spring/Classloader-CamelContext1.xml", OSGiJettyCamelContextsClassloaderTest.class.getResource("Classloader-CamelContext1.xml"))
- .add(JettyClassloaderCheckProcessor.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "org.apache.camel.itest.osgi.CamelContextBundle1")
- .set(Constants.BUNDLE_NAME, "CamelContext1")
- .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
- .build()),
-
- //set up the camel context bundle1
- provision(TinyBundles.bundle().add("META-INF/spring/Classloader-CamelContext2.xml", OSGiJettyCamelContextsClassloaderTest.class.getResource("Classloader-CamelContext2.xml"))
- .add(JettyClassloaderCheckProcessor.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "org.apache.camel.itest.osgi.CamelContextBundle2")
- .set(Constants.BUNDLE_NAME, "CamelContext2")
- .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
- .build()));
-
- 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/jetty/OSGiMulitJettyCamelContextsTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/OSGiMulitJettyCamelContextsTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/OSGiMulitJettyCamelContextsTest.java
deleted file mode 100644
index ce8dbb1..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/OSGiMulitJettyCamelContextsTest.java
+++ /dev/null
@@ -1,90 +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.jetty;
-
-import org.apache.camel.CamelExecutionException;
-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 org.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.Constants;
-
-import static org.ops4j.pax.exam.CoreOptions.provision;
-import static org.ops4j.pax.exam.OptionUtils.combine;
-
-@RunWith(PaxExam.class)
-public class OSGiMulitJettyCamelContextsTest extends OSGiIntegrationTestSupport {
-
- @Test
- public void testStoppingJettyContext() throws Exception {
- // Wait a while to let all the service started
- Thread.sleep(3000);
- String endpointURI = "http://localhost:9010/context1/";
- String response = template.requestBody(endpointURI, "Hello World", String.class);
- assertEquals("response is " , "camelContext1", response);
-
- endpointURI = "http://localhost:9010/context2/";
- response = template.requestBody(endpointURI, "Hello World", String.class);
- assertEquals("response is " , "camelContext2", response);
-
- getInstalledBundle("org.apache.camel.itest.osgi.CamelContextBundle1").uninstall();
-
- endpointURI = "http://localhost:9010/context1/";
- try {
- template.requestBody(endpointURI, "Hello World", String.class);
- fail("We are expect the exception here");
- } catch (Exception ex) {
- assertTrue("Get the wrong exception.", ex instanceof CamelExecutionException);
- }
-
- endpointURI = "http://localhost:9010/context2/";
- response = template.requestBody(endpointURI, "Hello World", String.class);
- assertEquals("response is " , "camelContext2", response);
- }
-
- @Configuration
- public static Option[] configure() {
- Option[] options = combine(
- getDefaultCamelKarafOptions(),
- // using the features to install the other camel components
- loadCamelFeatures("camel-jetty"),
- //set up the camel context bundle1
- provision(TinyBundles.bundle().add("META-INF/spring/CamelContext1.xml", OSGiMulitJettyCamelContextsTest.class.getResource("CamelContext1.xml"))
- .add(JettyProcessor.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "org.apache.camel.itest.osgi.CamelContextBundle1")
- .set(Constants.BUNDLE_NAME, "CamelContext1")
- .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
- .build()),
-
- //set up the camel context bundle1
- provision(TinyBundles.bundle().add("META-INF/spring/CamelContext2.xml", OSGiMulitJettyCamelContextsTest.class.getResource("CamelContext2.xml"))
- .add(JettyProcessor.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "org.apache.camel.itest.osgi.CamelContextBundle2")
- .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
- .set(Constants.BUNDLE_NAME, "CamelContext2").build())
- );
-
- 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/jms/JmsTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jms/JmsTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jms/JmsTest.java
deleted file mode 100644
index fa9aa65..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jms/JmsTest.java
+++ /dev/null
@@ -1,73 +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.jms;
-
-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.ops4j.pax.exam.options.MavenArtifactProvisionOption;
-import org.ops4j.pax.exam.options.UrlReference;
-import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext;
-
-import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.OptionUtils.combine;
-
-@RunWith(PaxExam.class)
-public class JmsTest extends OSGiIntegrationSpringTestSupport {
-
- @Override
- protected OsgiBundleXmlApplicationContext createApplicationContext() {
- return new OsgiBundleXmlApplicationContext(new String[]{"org/apache/camel/itest/osgi/jms/CamelContext.xml"});
- }
-
- public static UrlReference getActiveMQKarafFeatureUrl(String version) {
- String type = "xml/features";
- MavenArtifactProvisionOption mavenOption = mavenBundle().groupId("org.apache.activemq").artifactId("activemq-karaf");
- if (version == null) {
- return mavenOption.versionAsInProject().type(type);
- } else {
- return mavenOption.version(version).type(type);
- }
- }
-
- @Test
- public void testJms() throws Exception {
- getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
-
- template.sendBody("activemq:queue:foo", "Hello World");
-
- assertMockEndpointsSatisfied();
- }
-
- @Configuration
- public static Option[] configure() throws Exception {
- Option[] options = combine(
- getDefaultCamelKarafOptions(),
-
- // using the features to install AMQ
- scanFeatures(getActiveMQKarafFeatureUrl("5.10.1"), "activemq"),
-
- // using the features to install the camel components
- loadCamelFeatures("camel-jms"));
-
- 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/jpa/JpaBlueprintRouteTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaBlueprintRouteTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaBlueprintRouteTest.java
deleted file mode 100644
index 1c0f263..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaBlueprintRouteTest.java
+++ /dev/null
@@ -1,82 +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.jpa;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.itest.osgi.blueprint.OSGiBlueprintTestSupport;
-
-import org.junit.Ignore;
-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.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.Constants;
-
-import static org.ops4j.pax.exam.CoreOptions.provision;
-import static org.ops4j.pax.exam.OptionUtils.combine;
-
-@RunWith(PaxExam.class)
-@Ignore("Does not work properly")
-public class JpaBlueprintRouteTest extends OSGiBlueprintTestSupport {
-
- @Test
- public void testBlueprintRouteJpa() throws Exception {
- //getInstalledBundle("CamelBlueprintJpaTestBundle").start();
- CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintJpaTestBundle)", 20000);
-
- MockEndpoint mock = ctx.getEndpoint("mock:result", MockEndpoint.class);
- mock.expectedMessageCount(1);
-
- ProducerTemplate template = ctx.createProducerTemplate();
- template.sendBodyAndHeader("direct:start", "someone@somewhere.org", "index", 1);
- template.sendBodyAndHeader("direct:start", "someoneelse@somewhere.org", "index", 2);
-
- assertMockEndpointsSatisfied();
- }
-
- @Configuration
- public static Option[] configure() throws Exception {
-
- Option[] options = combine(
- getDefaultCamelKarafOptions(),
- provision(TinyBundles.bundle()
- .add(SendEmail.class)
- .add(MyProcessor.class)
- .add("META-INF/persistence.xml", JpaBlueprintRouteTest.class.getResource("/META-INF/persistence.xml"))
- .add("OSGI-INF/blueprint/test.xml", JpaBlueprintRouteTest.class.getResource("blueprintCamelContext.xml"))
- .set(Constants.BUNDLE_SYMBOLICNAME, "CamelBlueprintJpaTestBundle")
- .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
- .set("Meta-Persistence", "META-INF/persistence.xml")
- .build()),
-
- scanFeatures(getKarafEnterpriseFeatureUrl(), "jndi", "jpa", "transaction"),
- mavenBundle("org.apache.openjpa", "openjpa", "2.3.0"),
- mavenBundle("org.apache.derby", "derby", "10.4.2.0"),
- // using the features to install the camel components
- scanFeatures(getCamelKarafFeatureUrl(),
- "camel-blueprint", "camel-jpa"));
- //felix(), equinox());
-
- 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/jpa/JpaRouteTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaRouteTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaRouteTest.java
deleted file mode 100644
index e3bb417..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaRouteTest.java
+++ /dev/null
@@ -1,144 +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.jpa;
-
-import java.util.List;
-
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
-import org.apache.camel.spring.SpringCamelContext;
-import org.apache.camel.util.IOHelper;
-import org.junit.After;
-import org.junit.Before;
-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.osgi.framework.BundleContext;
-
-
-import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext;
-import org.springframework.transaction.TransactionStatus;
-import org.springframework.transaction.support.TransactionCallback;
-import org.springframework.transaction.support.TransactionTemplate;
-
-import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.OptionUtils.combine;
-
-@RunWith(PaxExam.class)
-public class JpaRouteTest extends OSGiIntegrationTestSupport {
- protected static final String SELECT_ALL_STRING = "select x from " + SendEmail.class.getName() + " x";
-
- protected OsgiBundleXmlApplicationContext applicationContext;
-
- protected TransactionTemplate transactionTemplate;
- protected EntityManager entityManager;
-
- @Inject
- protected BundleContext bundleContext;
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
- EntityManagerFactory entityManagerFactory = applicationContext.getBean("entityManagerFactory",
- EntityManagerFactory.class);
- transactionTemplate = applicationContext.getBean("transactionTemplate", TransactionTemplate.class);
- entityManager = entityManagerFactory.createEntityManager();
- cleanupRepository();
- }
-
-
- @Test
- public void testRouteJpa() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedMessageCount(1);
-
- template.sendBody("direct:start", new SendEmail(1L, "someone@somewhere.org"));
-
- assertMockEndpointsSatisfied();
- assertEntityInDB(1);
- }
-
- @After
- public void tearDown() {
- try {
- super.tearDown();
- if (applicationContext != null) {
- if (applicationContext.isActive()) {
- IOHelper.close(applicationContext);
- }
- applicationContext = null;
- }
- } catch (Exception exception) {
- // Don't throw the exception in the tearDown method
- }
- }
-
- @Override
- protected CamelContext createCamelContext() throws Exception {
- setThreadContextClassLoader();
- applicationContext = new OsgiBundleXmlApplicationContext(
- new String[]{"org/apache/camel/itest/osgi/jpa/springJpaRouteContext.xml"});
- if (bundleContext != null) {
- applicationContext.setBundleContext(bundleContext);
- applicationContext.refresh();
- }
- return SpringCamelContext.springCamelContext(applicationContext);
- }
-
- private void assertEntityInDB(int size) throws Exception {
- List<?> list = entityManager.createQuery(SELECT_ALL_STRING).getResultList();
- assertEquals(size, list.size());
-
- assertIsInstanceOf(SendEmail.class, list.get(0));
- }
-
- private void cleanupRepository() {
- transactionTemplate.execute(new TransactionCallback<Object>() {
- public Object doInTransaction(TransactionStatus arg0) {
- entityManager.joinTransaction();
- List<?> list = entityManager.createQuery(SELECT_ALL_STRING).getResultList();
- for (Object item : list) {
- entityManager.remove(item);
- }
- entityManager.flush();
- return Boolean.TRUE;
- }
- });
- }
-
- @Configuration
- public static Option[] configure() throws Exception {
- Option[] options = combine(
-
- getDefaultCamelKarafOptions(),
- // using the features to install the camel components
- loadCamelFeatures("camel-jpa"),
-
- // use derby as the database
- mavenBundle().groupId("org.apache.openjpa").artifactId("openjpa").version("2.3.0"),
- mavenBundle().groupId("org.apache.derby").artifactId("derby").version("10.4.2.0"));
-
- 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/jpa/MyProcessor.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/MyProcessor.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/MyProcessor.java
deleted file mode 100644
index b5de649..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/MyProcessor.java
+++ /dev/null
@@ -1,35 +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.jpa;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.Processor;
-
-public class MyProcessor implements Processor {
-
- @Override
- public void process(Exchange exchange) throws Exception {
- // create SendEmail instance
- Message in = exchange.getIn();
- long index = (Integer)in.getHeader("index");
- String email = in.getBody(String.class);
- exchange.getOut().setBody(new SendEmail(index, email));
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/SendEmail.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/SendEmail.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/SendEmail.java
deleted file mode 100644
index 4ddbc17..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/SendEmail.java
+++ /dev/null
@@ -1,67 +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.jpa;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-/**
- * Represents a task which is added to the database, then removed from the database when it is consumed
- *
- * @version
- */
-@Entity
-@Table(name = "SENDEMAIL")
-public class SendEmail {
- private Long id;
- private String address;
-
- public SendEmail() {
- }
-
- public SendEmail(Long id, String address) {
- setId(id);
- setAddress(address);
- }
-
- public SendEmail(String address) {
- setAddress(address);
- }
-
- @Override
- public String toString() {
- return "SendEmail[id: " + getId() + " address: " + getAddress() + "]";
- }
-
- @Id
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getAddress() {
- return address;
- }
-
- public void setAddress(String address) {
- this.address = address;
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jsch/ScpTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jsch/ScpTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jsch/ScpTest.java
deleted file mode 100644
index 563a4e0..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jsch/ScpTest.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.jsch;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.itest.osgi.OSGiIntegrationSpringTestSupport;
-
-import org.junit.Ignore;
-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)
-@Ignore("Not fully implemented, see TODO")
-public class ScpTest extends OSGiIntegrationSpringTestSupport {
-
- @Override
- protected OsgiBundleXmlApplicationContext createApplicationContext() {
- return new OsgiBundleXmlApplicationContext(new String[]{"org/apache/camel/itest/osgi/jsch/CamelContext.xml"});
- }
-
- @Test
- public void testScp() throws Exception {
- getMockEndpoint("mock:result").expectedMessageCount(1);
-
- template.sendBodyAndHeader("scp://localhost:21003/target?username=admin&password=admin", "Hello World", Exchange.FILE_NAME, "hello.txt");
-
- assertMockEndpointsSatisfied();
- }
- @Configuration
- public static Option[] configure() throws Exception {
- Option[] options = combine(
- getDefaultCamelKarafOptions(),
- // using the features to install the camel components
- loadCamelFeatures("camel-jsch"));
-
-
- 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/krati/KratiBlueprintRouteTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/krati/KratiBlueprintRouteTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/krati/KratiBlueprintRouteTest.java
deleted file mode 100644
index 3d92330..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/krati/KratiBlueprintRouteTest.java
+++ /dev/null
@@ -1,75 +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.krati;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.component.krati.KratiConstants;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.itest.osgi.blueprint.OSGiBlueprintTestSupport;
-
-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.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.Constants;
-
-import static org.ops4j.pax.exam.CoreOptions.provision;
-import static org.ops4j.pax.exam.OptionUtils.combine;
-
-@RunWith(PaxExam.class)
-public class KratiBlueprintRouteTest extends OSGiBlueprintTestSupport {
-
- @Test
- public void testProducerConsumerAndIdempotent() throws Exception {
- CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintKratiTestBundle)", 20000);
-
- MockEndpoint mock = ctx.getEndpoint("mock:results", MockEndpoint.class);
- ProducerTemplate template = ctx.createProducerTemplate();
- mock.expectedMessageCount(2);
-
- template.sendBodyAndHeader("direct:put", new SomeObject("1", "Test 1"), KratiConstants.KEY, "1");
- template.sendBodyAndHeader("direct:put", new SomeObject("2", "Test 2"), KratiConstants.KEY, "2");
- template.sendBodyAndHeader("direct:put", new SomeObject("3", "Test 3"), KratiConstants.KEY, "1");
-
- assertMockEndpointsSatisfied();
-
- template.stop();
- }
-
- @Configuration
- public static Option[] configure() throws Exception {
- Option[] options = combine(
-
- getDefaultCamelKarafOptions(),
- // using the features to install the camel components
- loadCamelFeatures("camel-blueprint", "camel-krati"),
-
- provision(TinyBundles.bundle()
- .add(SomeObject.class)
- .add("META-INF/persistence.xml", KratiBlueprintRouteTest.class.getResource("/META-INF/persistence.xml"))
- .add("OSGI-INF/blueprint/test.xml", KratiBlueprintRouteTest.class.getResource("blueprintCamelContext.xml"))
- .set(Constants.BUNDLE_SYMBOLICNAME, "CamelBlueprintKratiTestBundle")
- .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
- .build()));
-
- 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/krati/KratiRouteTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/krati/KratiRouteTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/krati/KratiRouteTest.java
deleted file mode 100644
index 16be8b2..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/krati/KratiRouteTest.java
+++ /dev/null
@@ -1,76 +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.krati;
-
-import javax.inject.Inject;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.component.krati.KratiConstants;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
-import org.apache.camel.spring.SpringCamelContext;
-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.osgi.framework.BundleContext;
-import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext;
-
-import static org.ops4j.pax.exam.OptionUtils.combine;
-
-@RunWith(PaxExam.class)
-public class KratiRouteTest extends OSGiIntegrationTestSupport {
-
- protected OsgiBundleXmlApplicationContext applicationContext;
-
- @Inject
- protected BundleContext bundleContext;
-
- @Test
- public void testProducerConsumerAndIdempotent() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedMessageCount(2);
- template.sendBodyAndHeader("direct:put", new SomeObject("1", "Test 1"), KratiConstants.KEY, "1");
- template.sendBodyAndHeader("direct:put", new SomeObject("2", "Test 2"), KratiConstants.KEY, "2");
- template.sendBodyAndHeader("direct:put", new SomeObject("3", "Test 3"), KratiConstants.KEY, "1");
- assertMockEndpointsSatisfied();
- }
-
- @Override
- protected CamelContext createCamelContext() throws Exception {
- setThreadContextClassLoader();
- applicationContext = new OsgiBundleXmlApplicationContext(
- new String[]{"org/apache/camel/itest/osgi/krati/springKratiRouteContext.xml"});
- if (bundleContext != null) {
- applicationContext.setBundleContext(bundleContext);
- applicationContext.refresh();
- }
- return SpringCamelContext.springCamelContext(applicationContext);
- }
-
- @Configuration
- public static Option[] configure() throws Exception {
- Option[] options = combine(
- getDefaultCamelKarafOptions(),
- // using the features to install the camel components
- loadCamelFeatures("camel-krati"));
-
- 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/krati/SomeObject.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/krati/SomeObject.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/krati/SomeObject.java
deleted file mode 100644
index d772141..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/krati/SomeObject.java
+++ /dev/null
@@ -1,48 +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.krati;
-
-import java.io.Serializable;
-
-public class SomeObject implements Serializable {
-
- private static final long serialVersionUID = 1L;
- private String id;
- private String value;
-
- public SomeObject(String id, String value) {
- this.id = id;
- this.value = value;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/6b77d012/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/leveldb/LevelDBAggregateRouteTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/leveldb/LevelDBAggregateRouteTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/leveldb/LevelDBAggregateRouteTest.java
deleted file mode 100644
index eaf630b..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/leveldb/LevelDBAggregateRouteTest.java
+++ /dev/null
@@ -1,102 +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.leveldb;
-
-import java.util.concurrent.TimeUnit;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.leveldb.LevelDBAggregationRepository;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
-import org.apache.camel.processor.aggregate.AggregationStrategy;
-import org.junit.Ignore;
-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)
-@Ignore("leveldb artifact needs to be osgi bundle.")
-public class LevelDBAggregateRouteTest extends OSGiIntegrationTestSupport {
-
- @Test
- public void testLevelDBAggregateRoute() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:aggregated");
- mock.expectedBodiesReceived("ABCDE");
-
- template.sendBodyAndHeader("direct:start", "A", "id", 123);
- template.sendBodyAndHeader("direct:start", "B", "id", 123);
- template.sendBodyAndHeader("direct:start", "C", "id", 123);
- template.sendBodyAndHeader("direct:start", "D", "id", 123);
- template.sendBodyAndHeader("direct:start", "E", "id", 123);
-
- assertMockEndpointsSatisfied(30, TimeUnit.SECONDS);
-
- // from endpoint should be preserved
- assertEquals("direct://start", mock.getReceivedExchanges().get(0).getFromEndpoint().getEndpointUri());
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- // delete the data directory
- deleteDirectory("target/data");
-
- // create the leveldb repo
- LevelDBAggregationRepository repo = new LevelDBAggregationRepository("repo1", "target/data/leveldb.dat");
-
- // here is the Camel route where we aggregate
- from("direct:start")
- .aggregate(header("id"), new MyAggregationStrategy())
- // use our created leveldb repo as aggregation repository
- .completionSize(5).aggregationRepository(repo)
- .to("mock:aggregated");
- }
- };
- }
-
- public static class MyAggregationStrategy implements AggregationStrategy {
-
- public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
- if (oldExchange == null) {
- return newExchange;
- }
- String body1 = oldExchange.getIn().getBody(String.class);
- String body2 = newExchange.getIn().getBody(String.class);
-
- oldExchange.getIn().setBody(body1 + body2);
- return oldExchange;
- }
- }
-
- @Configuration
- public static Option[] configure() {
- Option[] options = combine(
- getDefaultCamelKarafOptions(),
- // using the features to install the other camel components
- loadCamelFeatures("camel-leveldb"));
-
- return options;
- }
-
-}