hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahue...@apache.org
Subject svn commit: r513501 - in /hivemind/hivemind2/trunk/xml/src: java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java test/org/apache/hivemind/xml/OverrideService.xml test/org/apache/hivemind/xml/TestServiceOverride.java
Date Thu, 01 Mar 2007 23:25:41 GMT
Author: ahuegen
Date: Thu Mar  1 13:15:57 2007
New Revision: 513501

URL: http://svn.apache.org/viewvc?view=rev&rev=513501
Log:
Overriding of services in xml fixed

Added:
    hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/xml/OverrideService.xml
    hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/xml/TestServiceOverride.java
  (contents, props changed)
      - copied, changed from r505487, hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/xml/TestSubModule.java
Modified:
    hivemind/hivemind2/trunk/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java

Modified: hivemind/hivemind2/trunk/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java?view=diff&rev=513501&r1=513500&r2=513501
==============================================================================
--- hivemind/hivemind2/trunk/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java
(original)
+++ hivemind/hivemind2/trunk/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java
Thu Mar  1 13:15:57 2007
@@ -218,7 +218,8 @@
     }
 
     /**
-     * Adds one implementation and its interceptors to a module definition.
+     * Adds one standalone implementation and its interceptors to a module definition.
+     * This implementation overrides inline implementations of the service point.
      */
     private void addImplementationAndInterceptors(ModuleDefinitionImpl sourceModule, String
qualifiedPointId, ImplementationDescriptor id)
     {
@@ -228,7 +229,7 @@
         if (builder != null) {
             ImplementationDefinitionImpl implementation = new ImplementationDefinitionImpl(
                     sourceModule, builder.getLocation(), builder.createConstructor(sourceModule.getId()),
-                    builder.getServiceModel(), false);
+                    builder.getServiceModel(), true);
             sourceModule.addImplementation(qualifiedPointId, implementation); 
         }
         

Added: hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/xml/OverrideService.xml
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/xml/OverrideService.xml?view=auto&rev=513501
==============================================================================
--- hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/xml/OverrideService.xml (added)
+++ hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/xml/OverrideService.xml Thu
Mar  1 13:15:57 2007
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!-- 
+   Copyright 2004, 2005 The Apache Software Foundation
+
+   Licensed 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.
+-->
+
+<module id="hivemind.test.override" version="1.0.0">
+
+  <service-point id="TestService" interface="java.lang.Runnable" >
+    <create-instance class="hivemind.test.services.impl.RunnableImpl" model="primitive"/>
+  </service-point>
+  
+  <implementation service-id="TestService">
+    <create-instance class="org.apache.hivemind.service.impl.MockRunnable" model="primitive"/>
+  </implementation>
+
+</module>
\ No newline at end of file

Copied: hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/xml/TestServiceOverride.java
(from r505487, hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/xml/TestSubModule.java)
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/xml/TestServiceOverride.java?view=diff&rev=513501&p1=hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/xml/TestSubModule.java&r1=505487&p2=hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/xml/TestServiceOverride.java&r2=513501
==============================================================================
--- hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/xml/TestSubModule.java (original)
+++ hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/xml/TestServiceOverride.java
Thu Mar  1 13:15:57 2007
@@ -14,36 +14,26 @@
 
 package org.apache.hivemind.xml;
 
-import hivemind.test.services.SimpleService;
-
 import org.apache.hivemind.Registry;
+import org.apache.hivemind.service.impl.MockRunnable;
 
 /**
- * Tests the ability for a module to include &lt;sub-module&gt;s.
+ * Tests the overriding of a service implementation.
  * 
  * @author Howard Lewis Ship
  */
-public class TestSubModule extends XmlTestCase
+public class TestServiceOverride extends XmlTestCase
 {
     public void testNestedSubModule() throws Exception
     {
-        Registry r = buildFrameworkRegistry("OuterModule.xml");
-
-        SimpleService s = (SimpleService) r.getService(
-                "hivemind.test.outer.Simple",
-                SimpleService.class);
-
-        assertEquals(11, s.add(4, 7));
+        Registry r = buildFrameworkRegistry("OverrideService.xml");
 
-    }
-
-    public void testMissingSubModule() throws Exception
-    {
-        interceptLogging();
+        Runnable service = (Runnable) r.getService(
+                "hivemind.test.override.TestService",
+                Runnable.class);
 
-        buildFrameworkRegistry("MissingSubModule.xml");
+        assertTrue(service instanceof MockRunnable);
 
-        assertLoggedMessagePattern("Sub-module .*?/DoesNotExist\\.xml does not exist\\.");
     }
 
 }

Propchange: hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/xml/TestServiceOverride.java
------------------------------------------------------------------------------
    cvs2svn:cvs-rev = 1.6

Propchange: hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/xml/TestServiceOverride.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/xml/TestServiceOverride.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



Mime
View raw message