Repository: cxf-dosgi Updated Branches: refs/heads/master 37cf7d355 -> 3f8afd08c
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/3f8afd08/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestImportService.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestImportService.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestImportService.java deleted file mode 100644 index 9e435a8..0000000 --- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestImportService.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.cxf.dosgi.systests2.multi; - -import static org.ops4j.pax.exam.CoreOptions.provision; -import static org.ops4j.pax.exam.CoreOptions.systemProperty; - -import java.io.InputStream; -import java.util.Map; - -import javax.inject.Inject; - -import org.apache.cxf.aegis.databinding.AegisDatabinding; -import org.apache.cxf.dosgi.samples.greeter.GreeterService; -import org.apache.cxf.dosgi.samples.greeter.GreetingPhrase; -import org.apache.cxf.dosgi.systests2.multi.importservice.SimpleGreeter; -import org.apache.cxf.endpoint.Server; -import org.apache.cxf.frontend.ServerFactoryBean; -import org.junit.After; -import org.junit.Assert; -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.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Constants; - -@RunWith(PaxExam.class) -public class TestImportService extends AbstractDosgiTest { - @Inject - GreeterService greeterService; - private Server server; - - @Configuration - public static Option[] configure() throws Exception { - return new Option[] // - {// - basicTestOptions(), // - greeterInterface(), // - provision(createServiceConsumerBundle()), // - // increase for debugging - systemProperty("org.apache.cxf.dosgi.test.serviceWaitTimeout") - .value(System.getProperty("org.apache.cxf.dosgi.test.serviceWaitTimeout", "200")), - }; - } - - protected static InputStream createServiceConsumerBundle() { - return TinyBundles.bundle() // - .add("OSGI-INF/remote-service/remote-services.xml", - TestImportService.class.getResource("/rs-test1.xml")) // - .set(Constants.BUNDLE_SYMBOLICNAME, "importConfig") // - .build(TinyBundles.withBnd()); - } - - @Before - public void createCXFService() { - server = publishTestGreeter(); - } - - @Test - public void testClientConsumer() throws Exception { - Map<GreetingPhrase, String> result = greeterService.greetMe("OSGi"); - GreetingPhrase phrase = result.keySet().iterator().next(); - Assert.assertEquals("Hi", phrase.getPhrase()); - } - - @After - public void stopCXFService() { - server.stop(); - } - - private Server publishTestGreeter() { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - try { - Thread.currentThread().setContextClassLoader(ServerFactoryBean.class.getClassLoader()); - ServerFactoryBean factory = new ServerFactoryBean(); - factory.setServiceClass(GreeterService.class); - factory.setAddress("http://localhost:9191/grrr"); - factory.getServiceFactory().setDataBinding(new AegisDatabinding()); - factory.setServiceBean(new SimpleGreeter()); - return factory.create(); - } finally { - Thread.currentThread().setContextClassLoader(cl); - } - } -} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/3f8afd08/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/AddGreetingPhraseInterceptor.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/AddGreetingPhraseInterceptor.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/AddGreetingPhraseInterceptor.java deleted file mode 100644 index a3a19be..0000000 --- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/AddGreetingPhraseInterceptor.java +++ /dev/null @@ -1,44 +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.cxf.dosgi.systests2.multi.customintent; - -import java.util.List; -import java.util.Map; - -import org.apache.cxf.dosgi.samples.greeter.GreetingPhrase; -import org.apache.cxf.helpers.CastUtils; -import org.apache.cxf.interceptor.Fault; -import org.apache.cxf.message.Message; -import org.apache.cxf.message.MessageContentsList; -import org.apache.cxf.phase.AbstractPhaseInterceptor; - -public final class AddGreetingPhraseInterceptor extends AbstractPhaseInterceptor<Message> { - - AddGreetingPhraseInterceptor(String phase) { - super(phase); - } - - public void handleMessage(Message message) throws Fault { - MessageContentsList contents = (MessageContentsList) message.getContent(List.class); - Map<GreetingPhrase, String> result = CastUtils.cast((Map<?, ?>)contents.get(0)); - result.put(new GreetingPhrase("Hi from custom intent"), "customintent"); - //Object content1 = contents.iterator().next(); - System.out.println(message); - } -} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/3f8afd08/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomFeature.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomFeature.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomFeature.java deleted file mode 100644 index abac14f..0000000 --- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomFeature.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.cxf.dosgi.systests2.multi.customintent; - -import org.apache.cxf.Bus; -import org.apache.cxf.feature.AbstractFeature; -import org.apache.cxf.interceptor.InterceptorProvider; -import org.apache.cxf.phase.Phase; - -public final class CustomFeature extends AbstractFeature { - - @Override - protected void initializeProvider(InterceptorProvider provider, Bus bus) { - provider.getOutInterceptors().add(0, new AddGreetingPhraseInterceptor(Phase.USER_LOGICAL)); - super.initializeProvider(provider, bus); - } -} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/3f8afd08/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomIntentActivator.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomIntentActivator.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomIntentActivator.java deleted file mode 100644 index a69c6f3..0000000 --- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomIntentActivator.java +++ /dev/null @@ -1,37 +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.cxf.dosgi.systests2.multi.customintent; - -import java.util.Dictionary; -import java.util.Hashtable; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; - -public class CustomIntentActivator implements BundleActivator { - - public void start(BundleContext context) throws Exception { - Dictionary<String, String> props = new Hashtable<String, String>(); - props.put("org.apache.cxf.dosgi.IntentName", "myIntent"); - context.registerService(CustomFeature.class.getName(), new CustomFeature(), props); - } - - public void stop(BundleContext context) throws Exception { - } -} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/3f8afd08/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/EmptyGreeterService.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/EmptyGreeterService.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/EmptyGreeterService.java deleted file mode 100644 index 2c0108d..0000000 --- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/EmptyGreeterService.java +++ /dev/null @@ -1,41 +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.cxf.dosgi.systests2.multi.customintent.service; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.cxf.dosgi.samples.greeter.GreeterData; -import org.apache.cxf.dosgi.samples.greeter.GreeterException; -import org.apache.cxf.dosgi.samples.greeter.GreeterService; -import org.apache.cxf.dosgi.samples.greeter.GreetingPhrase; - -public final class EmptyGreeterService implements GreeterService { - - /** - * Return an empty array. Our custom intent should add a GreetingPhrase - */ - public GreetingPhrase[] greetMe(GreeterData name) throws GreeterException { - return new GreetingPhrase[]{}; - } - - public Map<GreetingPhrase, String> greetMe(String name) { - return new HashMap<GreetingPhrase, String>(); - } -} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/3f8afd08/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/GreeterServiceWithCustomIntentActivator.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/GreeterServiceWithCustomIntentActivator.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/GreeterServiceWithCustomIntentActivator.java deleted file mode 100644 index bcf6016..0000000 --- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/GreeterServiceWithCustomIntentActivator.java +++ /dev/null @@ -1,42 +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.cxf.dosgi.systests2.multi.customintent.service; - -import java.util.Dictionary; -import java.util.Hashtable; - -import org.apache.cxf.dosgi.samples.greeter.GreeterService; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.service.remoteserviceadmin.RemoteConstants; - -public class GreeterServiceWithCustomIntentActivator implements BundleActivator { - - public void start(BundleContext context) throws Exception { - Dictionary<String, String> props = new Hashtable<String, String>(); - props.put(RemoteConstants.SERVICE_EXPORTED_INTERFACES, "*"); - props.put(RemoteConstants.SERVICE_EXPORTED_CONFIGS, "org.apache.cxf.ws"); - props.put("org.apache.cxf.ws.address", "http://localhost:9090/greeter"); - props.put(RemoteConstants.SERVICE_EXPORTED_INTENTS, "myIntent"); - context.registerService(GreeterService.class.getName(), new EmptyGreeterService(), props); - } - - public void stop(BundleContext context) throws Exception { - } -} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/3f8afd08/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/importservice/SimpleGreeter.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/importservice/SimpleGreeter.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/importservice/SimpleGreeter.java deleted file mode 100644 index e39c315..0000000 --- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/importservice/SimpleGreeter.java +++ /dev/null @@ -1,41 +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.cxf.dosgi.systests2.multi.importservice; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.cxf.dosgi.samples.greeter.GreeterData; -import org.apache.cxf.dosgi.samples.greeter.GreeterException; -import org.apache.cxf.dosgi.samples.greeter.GreeterService; -import org.apache.cxf.dosgi.samples.greeter.GreetingPhrase; - -public class SimpleGreeter implements GreeterService { - - public Map<GreetingPhrase, String> greetMe(String name) { - Map<GreetingPhrase, String> m = new HashMap<GreetingPhrase, String>(); - GreetingPhrase gp = new GreetingPhrase("Hi"); - m.put(gp, name); - return m; - } - - public GreetingPhrase[] greetMe(GreeterData gd) throws GreeterException { - throw new GreeterException("TestGreeter"); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/3f8afd08/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslate.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslate.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslate.java deleted file mode 100644 index 3a55c0e..0000000 --- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslate.java +++ /dev/null @@ -1,34 +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.cxf.dosgi.systests2.multi.rest; - -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; - -public interface RestTranslate { - - @GET - String englishWords(); - - @GET - @Path("/{word}") - String getTranslation(@PathParam("word") String word); - -} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/3f8afd08/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslateImpl.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslateImpl.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslateImpl.java deleted file mode 100644 index 640b0c9..0000000 --- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslateImpl.java +++ /dev/null @@ -1,41 +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.cxf.dosgi.systests2.multi.rest; - -import java.util.HashMap; -import java.util.Map; - -public class RestTranslateImpl implements RestTranslate { - Map<String, String> translation; - - public RestTranslateImpl() { - translation = new HashMap<String, String>(); - translation.put("hello", "hallo"); - } - - @Override - public String englishWords() { - return translation.keySet().toString(); - } - - @Override - public String getTranslation(String word) { - return translation.get(word); - } -} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/3f8afd08/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/TranslateActivator.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/TranslateActivator.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/TranslateActivator.java deleted file mode 100644 index a6b1892..0000000 --- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/TranslateActivator.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.cxf.dosgi.systests2.multi.rest; - -import java.util.Dictionary; -import java.util.Hashtable; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.service.remoteserviceadmin.RemoteConstants; - -public class TranslateActivator implements BundleActivator { - - public void start(BundleContext context) throws Exception { - Dictionary<String, String> props = new Hashtable<String, String>(); - props.put(RemoteConstants.SERVICE_EXPORTED_INTERFACES, "*"); - props.put(RemoteConstants.SERVICE_EXPORTED_CONFIGS, "org.apache.cxf.rs"); - props.put("org.apache.cxf.rs.address", "/translate"); - context.registerService(RestTranslate.class, new RestTranslateImpl(), props); - } - - public void stop(BundleContext context) throws Exception { - } -} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/3f8afd08/itests/multi-bundle/src/test/resources/rs-test1.xml ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/resources/rs-test1.xml b/itests/multi-bundle/src/test/resources/rs-test1.xml index 7392d24..c35592c 100644 --- a/itests/multi-bundle/src/test/resources/rs-test1.xml +++ b/itests/multi-bundle/src/test/resources/rs-test1.xml @@ -18,10 +18,10 @@ <endpoint-description> <property name="objectClass"> <array> - <value>org.apache.cxf.dosgi.samples.greeter.GreeterService</value> + <value>org.apache.cxf.dosgi.samples.soap.TaskService</value> </array> </property> - <property name="endpoint.id">http://localhost:9191/grrr</property> + <property name="endpoint.id">http://localhost:9191/taskservice</property> <property name="service.imported.configs">org.apache.cxf.ws</property> </endpoint-description> </endpoint-descriptions> http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/3f8afd08/parent/pom.xml ---------------------------------------------------------------------- diff --git a/parent/pom.xml b/parent/pom.xml index 19be3c8..461b71f 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -22,7 +22,7 @@ <artifactId>cxf-dosgi-ri-parent</artifactId> <packaging>pom</packaging> - <name>CXF DOSGi Parent</name> + <name>CXF DOSGi Parent</name> <properties> <!-- portable text resource processing --> http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/3f8afd08/samples/rest/api/bnd.bnd ---------------------------------------------------------------------- diff --git a/samples/rest/api/bnd.bnd b/samples/rest/api/bnd.bnd index d81f90b..ba154a1 100644 --- a/samples/rest/api/bnd.bnd +++ b/samples/rest/api/bnd.bnd @@ -1 +1,4 @@ -Export-Package: org.apache.cxf.dosgi.samples.rest \ No newline at end of file +Export-Package: org.apache.cxf.dosgi.samples.rest +Import-Package: \ + javax.xml.bind.annotation,\ + * \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/3f8afd08/samples/rest/api/src/main/resources/OSGI-INF/cxf/jaxrs/GreeterService2-model.xml ---------------------------------------------------------------------- diff --git a/samples/rest/api/src/main/resources/OSGI-INF/cxf/jaxrs/GreeterService2-model.xml b/samples/rest/api/src/main/resources/OSGI-INF/cxf/jaxrs/GreeterService2-model.xml deleted file mode 100644 index 2c4da17..0000000 --- a/samples/rest/api/src/main/resources/OSGI-INF/cxf/jaxrs/GreeterService2-model.xml +++ /dev/null @@ -1,7 +0,0 @@ -<model xmlns="http://cxf.apache.org/jaxrs"> - <resource name="org.apache.cxf.dosgi.samples.greeter.rest.GreeterService2" path="greeter"> - <operation name="greetMe" verb="GET" path="greeting/{name}"> - <param name="name" type="PATH"/> - </operation> - </resource> -</model> http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/3f8afd08/samples/rest/impl/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/TaskResourceImpl.java ---------------------------------------------------------------------- diff --git a/samples/rest/impl/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/TaskResourceImpl.java b/samples/rest/impl/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/TaskResourceImpl.java new file mode 100644 index 0000000..3b3e400 --- /dev/null +++ b/samples/rest/impl/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/TaskResourceImpl.java @@ -0,0 +1,76 @@ +/** + * 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.cxf.dosgi.samples.rest.impl; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.cxf.dosgi.samples.rest.Task; +import org.apache.cxf.dosgi.samples.rest.TaskResource; +import org.osgi.service.component.annotations.Component; + +@Component// +(// + immediate = true, // + name = "TaskResource", // + property = // + { // + "service.exported.interfaces=*", // + "service.exported.configs=org.apache.cxf.rs", // + "org.apache.cxf.rs.address=/tasks" // + } // +) +public class TaskResourceImpl implements TaskResource { + Map<Integer, Task> taskMap; + + public TaskResourceImpl() { + taskMap = new HashMap<Integer, Task>(); + Task task = new Task(); + task.setId(1); + task.setTitle("Buy some coffee"); + task.setDescription("Take the extra strong"); + addOrUpdate(task); + task = new Task(); + task.setId(2); + task.setTitle("Finish DOSGi example"); + task.setDescription(""); + addOrUpdate(task); + } + + @Override + public Task get(Integer id) { + return taskMap.get(id); + } + + @Override + public void addOrUpdate(Task task) { + taskMap.put(task.getId(), task); + } + + @Override + public Task[] getAll() { + return taskMap.values().toArray(new Task[]{}); + } + + @Override + public void delete(Integer id) { + taskMap.remove(id); + } + +} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/3f8afd08/samples/rest/impl/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/TaskServiceImpl.java ---------------------------------------------------------------------- diff --git a/samples/rest/impl/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/TaskServiceImpl.java b/samples/rest/impl/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/TaskServiceImpl.java deleted file mode 100644 index 2644e8d..0000000 --- a/samples/rest/impl/src/main/java/org/apache/cxf/dosgi/samples/rest/impl/TaskServiceImpl.java +++ /dev/null @@ -1,74 +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.cxf.dosgi.samples.rest.impl; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.cxf.dosgi.samples.rest.Task; -import org.apache.cxf.dosgi.samples.rest.TaskResource; -import org.osgi.service.component.annotations.Component; - -@Component(immediate = true, // -property = // -{ // - "name=TaskResource", - "service.exported.interfaces=*", // - "service.exported.configs=org.apache.cxf.rs", // - "org.apache.cxf.rs.address=/tasks" // -} // -) -public class TaskServiceImpl implements TaskResource { - Map<Integer, Task> taskMap; - - public TaskServiceImpl() { - taskMap = new HashMap<Integer, Task>(); - Task task = new Task(); - task.setId(1); - task.setTitle("Buy some coffee"); - task.setDescription("Take the extra strong"); - addOrUpdate(task); - task = new Task(); - task.setId(2); - task.setTitle("Finish DOSGi example"); - task.setDescription(""); - addOrUpdate(task); - } - - @Override - public Task get(Integer id) { - return taskMap.get(id); - } - - @Override - public void addOrUpdate(Task task) { - taskMap.put(task.getId(), task); - } - - @Override - public Task[] getAll() { - return taskMap.values().toArray(new Task[]{}); - } - - @Override - public void delete(Integer id) { - taskMap.remove(id); - } - -} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/3f8afd08/samples/soap/impl/src/main/java/org/apache/cxf/dosgi/samples/soap/impl/TaskServiceImpl.java ---------------------------------------------------------------------- diff --git a/samples/soap/impl/src/main/java/org/apache/cxf/dosgi/samples/soap/impl/TaskServiceImpl.java b/samples/soap/impl/src/main/java/org/apache/cxf/dosgi/samples/soap/impl/TaskServiceImpl.java index d2f94bf..4bf4dbe 100644 --- a/samples/soap/impl/src/main/java/org/apache/cxf/dosgi/samples/soap/impl/TaskServiceImpl.java +++ b/samples/soap/impl/src/main/java/org/apache/cxf/dosgi/samples/soap/impl/TaskServiceImpl.java @@ -27,14 +27,16 @@ import org.apache.cxf.dosgi.samples.soap.Task; import org.apache.cxf.dosgi.samples.soap.TaskService; import org.osgi.service.component.annotations.Component; -@Component(immediate = true, // -property = // -{ // - "name=TaskService", - "service.exported.interfaces=*", // - "service.exported.configs=org.apache.cxf.ws", // - "org.apache.cxf.ws.address=/taskservice" // -} // +@Component // +(// + immediate = true, // + name = "TaskService", // + property = // + { // + "service.exported.interfaces=*", // + "service.exported.configs=org.apache.cxf.ws", // + "org.apache.cxf.ws.address=/taskservice" // + } // ) public class TaskServiceImpl implements TaskService { Map<Integer, Task> taskMap;
