You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by kw...@apache.org on 2007/05/04 19:08:35 UTC
svn commit: r535329 - in /incubator/tuscany/java/sca/itest/extended-api/src:
main/java/org/apache/tuscany/sca/test/extended/
main/java/org/apache/tuscany/sca/test/extended/impl/ main/resources/
test/java/org/apache/tuscany/sca/test/extended/
Author: kwilliams
Date: Fri May 4 10:08:34 2007
New Revision: 535329
URL: http://svn.apache.org/viewvc?view=rev&rev=535329
Log:
More testing for locateService API
Added:
incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/MathService.java (with props)
incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/MathServiceImpl.java (with props)
incubator/tuscany/java/sca/itest/extended-api/src/main/resources/MathService.composite
Modified:
incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/BasicService.java
incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/BasicServiceImpl.java
incubator/tuscany/java/sca/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java
Modified: incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/BasicService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/BasicService.java?view=diff&rev=535329&r1=535328&r2=535329
==============================================================================
--- incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/BasicService.java (original)
+++ incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/BasicService.java Fri May 4 10:08:34 2007
@@ -21,5 +21,6 @@
public interface BasicService {
int negate(int theInt);
+ int delegateNegate(int theInt);
}
Added: incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/MathService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/MathService.java?view=auto&rev=535329
==============================================================================
--- incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/MathService.java (added)
+++ incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/MathService.java Fri May 4 10:08:34 2007
@@ -0,0 +1,25 @@
+/*
+ * 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.tuscany.sca.test.extended;
+
+public interface MathService {
+
+ int negate(int theInt);
+
+}
Propchange: incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/MathService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/MathService.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/BasicServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/BasicServiceImpl.java?view=diff&rev=535329&r1=535328&r2=535329
==============================================================================
--- incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/BasicServiceImpl.java (original)
+++ incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/BasicServiceImpl.java Fri May 4 10:08:34 2007
@@ -18,11 +18,9 @@
*/
package org.apache.tuscany.sca.test.extended.impl;
-import org.apache.tuscany.host.embedded.SCARuntime;
+import org.apache.tuscany.host.embedded.SCARuntimeActivator;
import org.apache.tuscany.sca.test.extended.BasicService;
-
-import org.osoa.sca.ComponentContext;
-import org.osoa.sca.ServiceReference;
+import org.apache.tuscany.sca.test.extended.MathService;
import org.osoa.sca.annotations.Service;
@Service(BasicService.class)
@@ -30,6 +28,14 @@
public int negate(int theInt) {
return -theInt;
+ }
+
+ public int delegateNegate(int theInt) {
+
+ MathService service = SCARuntimeActivator.locateService(MathService.class, "MathServiceComponent");
+
+ return service.negate(theInt);
+
}
Added: incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/MathServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/MathServiceImpl.java?view=auto&rev=535329
==============================================================================
--- incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/MathServiceImpl.java (added)
+++ incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/MathServiceImpl.java Fri May 4 10:08:34 2007
@@ -0,0 +1,31 @@
+/*
+ * 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.tuscany.sca.test.extended.impl;
+
+import org.apache.tuscany.sca.test.extended.MathService;
+import org.osoa.sca.annotations.Service;
+
+@Service(MathService.class)
+public class MathServiceImpl implements MathService {
+
+ public int negate(int theInt) {
+ return -theInt;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/MathServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/MathServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/extended-api/src/main/resources/MathService.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/extended-api/src/main/resources/MathService.composite?view=auto&rev=535329
==============================================================================
--- incubator/tuscany/java/sca/itest/extended-api/src/main/resources/MathService.composite (added)
+++ incubator/tuscany/java/sca/itest/extended-api/src/main/resources/MathService.composite Fri May 4 10:08:34 2007
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="MathServiceComposite">
+
+ <component name="MathServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.extended.impl.MathServiceImpl"/>
+ </component>
+
+</composite>
Modified: incubator/tuscany/java/sca/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java?view=diff&rev=535329&r1=535328&r2=535329
==============================================================================
--- incubator/tuscany/java/sca/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java (original)
+++ incubator/tuscany/java/sca/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java Fri May 4 10:08:34 2007
@@ -23,19 +23,43 @@
import org.apache.tuscany.host.embedded.SCARuntimeActivator;
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
public class ServiceLocateTestCase {
@Test
- public void locateService() {
+ public void unmanagedLocateService() {
BasicService service = SCARuntimeActivator.locateService(BasicService.class, "BasicServiceComponent");
assertEquals(-99, service.negate(99));
}
+
+ @Test
+ public void managedLocateService() {
+
+ BasicService service = SCARuntimeActivator.locateService(BasicService.class, "BasicServiceComponent");
+
+ assertEquals(-99, service.delegateNegate(99));
+
+ }
+
+ @Ignore
+ @Test
+ public void badComponentName() {
+
+ BasicService service = SCARuntimeActivator.locateService(BasicService.class, "IvalidComponentName");
+
+ assertEquals(-99, service.delegateNegate(99));
+
+ }
+
+
+
+
@Before
public void init() throws Exception {
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org