hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahue...@apache.org
Subject svn commit: r431096 [2/2] - in /hivemind/branches/branch-2-0-annot: ./ examples/ framework/ framework/src/java/org/apache/hivemind/definition/ framework/src/java/org/apache/hivemind/impl/ framework/src/java/org/apache/hivemind/internal/ framework/src/j...
Date Sat, 12 Aug 2006 22:00:22 GMT
Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/ContributionImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/ContributionImpl.java?rev=431096&r1=431095&r2=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/ContributionImpl.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/ContributionImpl.java
Sat Aug 12 15:00:19 2006
@@ -72,7 +72,7 @@
         XmlConfigurationPointNature xmlNature = (XmlConfigurationPointNature) configurationPoint.getNature(XmlConfigurationPointNature.class);
         if (xmlNature == null) {
             // TODO:
-            throw new ApplicationRuntimeException("ConfigurationPoint has no xml nature");
+            throw new ApplicationRuntimeException("Configuration point has no associated
xml schema. You can define one with a schema element that uses the configuration-id attribute");
         }
         
         Module contributingModule = configurationPoint.getModule().getModule(_contributingModuleId);

Copied: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/ServiceModelThreading.xml
(from r431063, hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/impl/ServiceModelThreading.xml)
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/ServiceModelThreading.xml?p2=hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/ServiceModelThreading.xml&p1=hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/impl/ServiceModelThreading.xml&r1=431063&r2=431096&rev=431096&view=diff
==============================================================================
    (empty)

Propchange: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/ServiceModelThreading.xml
------------------------------------------------------------------------------
    cvs2svn:cvs-rev = 1.2

Propchange: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/ServiceModelThreading.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/ServiceModelThreading.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/TestServiceModelThreading.java
(from r431063, hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/impl/TestServiceModelThreading.java)
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/TestServiceModelThreading.java?p2=hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/TestServiceModelThreading.java&p1=hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/impl/TestServiceModelThreading.java&r1=431063&r2=431096&rev=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/impl/TestServiceModelThreading.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/TestServiceModelThreading.java
Sat Aug 12 15:00:19 2006
@@ -15,15 +15,16 @@
 package org.apache.hivemind.impl;
 
 import org.apache.hivemind.Registry;
-import org.apache.hivemind.test.HiveMindTestCase;
+import org.apache.hivemind.xml.XmlTestCase;
 
 /**
  * Tests to verify that the service models work properly even under high-thread count concurrent
  * stress.
+ * TODO: move to framework module when autowiring is available there
  * 
  * @author Howard Lewis Ship
  */
-public class TestServiceModelThreading extends HiveMindTestCase
+public class TestServiceModelThreading extends XmlTestCase
 {
     public static final int THREAD_COUNT = 150;
 

Propchange: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/TestServiceModelThreading.java
------------------------------------------------------------------------------
    cvs2svn:cvs-rev = 1.3

Propchange: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/TestServiceModelThreading.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/TestServiceModelThreading.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java?rev=431096&r1=431095&r2=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java
Sat Aug 12 15:00:19 2006
@@ -8,6 +8,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.hivemind.ApplicationRuntimeException;
 import org.apache.hivemind.ErrorHandler;
 import org.apache.hivemind.Location;
 import org.apache.hivemind.conditional.EvaluationContextImpl;
@@ -311,7 +312,7 @@
     }
 
     /**
-     * Resolves schema references via id from contributions and services.
+     * Resolves schema references via id from configuration points and services.
      * All added module descriptors are processed.
      */
     public void resolveSchemas()
@@ -322,6 +323,7 @@
 
             resolveConfigurationPointSchemas(md);
             resolveServicePointSchemas(md);
+            resolveSubsequentSchemaAssociations(md);
         }
     }
 
@@ -346,6 +348,7 @@
                 if (schema == null) {
                     // Error-Handling has been done in findSchema already
                 } else {
+                    // TODO: check if schema has already been set (by resolveSubsequentSchemaAssociations)
                     xmlNature.setSchema(schema);
                     XmlConfigurationConstructor constructor = (XmlConfigurationConstructor)
point.getConstructor();
                     // store the root-element-classname in the constructor
@@ -378,6 +381,40 @@
                     xmlNature.setParametersSchema(schema);
                     xmlNature.setParametersCount(spd.getParametersCount());
                 }
+            }
+        }
+    }
+    
+    /**
+     * Adds schemas to configuration points for schemas that were associated
+     * with the configuration point subsequently by use of the "configuration-id" attribute.
+     * This is used if the original configuration point was defined in a non-xml module.
+     */
+    private void resolveSubsequentSchemaAssociations(ModuleDescriptor md)
+    {
+        Collection schemas = md.getSchemas();
+        for (Iterator iterPoints = schemas.iterator(); iterPoints.hasNext();)
+        {
+            Schema schema = (Schema) iterPoints.next();
+
+            if (schema.getConfigurationId() != null) {
+                ConfigurationPointDefinition cpd = _registryDefinition.getConfigurationPoint(schema.getConfigurationId());
+                if (cpd == null) {
+                    // TODO annotations: Exception handling
+                    throw new ApplicationRuntimeException("Unknown configuration point");
+                }
+                
+                XmlConfigurationPointNature xmlNature = (XmlConfigurationPointNature) cpd.getNature(XmlConfigurationPointNature.class);
+                // Add the xml nature if not already there. This can happen if configuration

+                // point wasn't defined in a xml module
+                if (xmlNature == null) {
+                    xmlNature = new XmlConfigurationPointNature();
+                    cpd.addNature(XmlConfigurationPointNature.class, xmlNature);
+                }
+
+                // TODO: check if schema has already been set
+                // TODO: more type related error handling, check root type of schema
+                xmlNature.setSchema(schema);
             }
         }
     }

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/parse/DescriptorParser.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/parse/DescriptorParser.java?rev=431096&r1=431095&r2=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/parse/DescriptorParser.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/parse/DescriptorParser.java
Sat Aug 12 15:00:19 2006
@@ -1069,6 +1069,8 @@
         if (visibility != null)
             schema.setVisibility(visibility);
         
+        schema.setConfigurationId(getAttribute("configuration-id"));
+        
         processRootElementClassName(schema);
 
         _moduleDescriptor.addSchema(schema);

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/parse/DescriptorParser.properties
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/parse/DescriptorParser.properties?rev=431096&r1=431095&r2=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/parse/DescriptorParser.properties
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/parse/DescriptorParser.properties
Sat Aug 12 15:00:19 2006
@@ -74,6 +74,7 @@
 required.schema.root-element-class=false
 required.schema{embedded}.root-element-class=false
 required.parameters-schema.root-element-class=false
+required.schema.configuration-id=false
 
 
 required.set-module.property=true

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/Schema.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/Schema.java?rev=431096&r1=431095&r2=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/Schema.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/Schema.java
Sat Aug 12 15:00:19 2006
@@ -66,4 +66,7 @@
     public String getDefiningModuleId();
     
     public String getRootElementClassName();
+    
+    public String getConfigurationId();
+
 }

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/impl/SchemaImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/impl/SchemaImpl.java?rev=431096&r1=431095&r2=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/impl/SchemaImpl.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/impl/SchemaImpl.java
Sat Aug 12 15:00:19 2006
@@ -44,6 +44,16 @@
     private String _id;
     
     private String _rootElementClassName;
+    
+    /** 
+     * The id of the configuration point the schema should be associated with.
+     * Needed for subsequent schema definitions in the xml module for configuration
+     * points that are already defined in the core framework which knows nothing
+     * about xml and schemas.
+     * 
+     * @since 2.0 
+     */
+    private String _configurationId;
 
     public SchemaImpl(String moduleId)
     {
@@ -130,5 +140,15 @@
     public void setRootElementClassName(String rootElementClassName)
     {
         _rootElementClassName = rootElementClassName;
+    }
+
+    public String getConfigurationId()
+    {
+        return _configurationId;
+    }
+
+    public void setConfigurationId(String configurationId)
+    {
+        _configurationId = configurationId;
     }
 }

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/RulesMessages.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/RulesMessages.java?rev=431096&r1=431095&r2=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/RulesMessages.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/RulesMessages.java
Sat Aug 12 15:00:19 2006
@@ -26,12 +26,12 @@
  * 
  * @author Howard Lewis Ship
  */
-class RulesMessages
+public class RulesMessages
 {
 
     protected static MessageFormatter _formatter = new MessageFormatter(RulesMessages.class);
 
-    static String unableToSetElementProperty(String propertyName, Object target,
+    public static String unableToSetElementProperty(String propertyName, Object target,
             SchemaProcessor processor, Element element, Throwable cause)
     {
         return _formatter.format("unable-to-set-element-property", new Object[]
@@ -39,107 +39,107 @@
                 cause });
     }
 
-    static String unableToSetProperty(String propertyName, Object target, Throwable cause)
+    public static String unableToSetProperty(String propertyName, Object target, Throwable
cause)
     {
         return _formatter.format("unable-to-set-property", propertyName, target, cause);
     }
 
-    static String invalidBooleanValue(String inputValue)
+    public static String invalidBooleanValue(String inputValue)
     {
         return _formatter.format("invalid-boolean-value", inputValue);
     }
 
-    static String invalidDoubleValue(String inputValue)
+    public static String invalidDoubleValue(String inputValue)
     {
         return _formatter.format("invalid-double-value", inputValue);
     }
 
-    static String minDoubleValue(String inputValue, double minValue)
+    public static String minDoubleValue(String inputValue, double minValue)
     {
         return _formatter.format("min-double-value", inputValue, new Double(minValue));
     }
 
-    static String maxDoubleValue(String inputValue, double maxValue)
+    public static String maxDoubleValue(String inputValue, double maxValue)
     {
         return _formatter.format("max-double-value", inputValue, new Double(maxValue));
     }
 
-    static String enumNotRecognized(String inputValue)
+    public static String enumNotRecognized(String inputValue)
     {
         return _formatter.format("enum-not-recognized", inputValue);
     }
 
-    static String enumError(Class enumClass, String fieldName, Throwable cause)
+    public static String enumError(Class enumClass, String fieldName, Throwable cause)
     {
         return _formatter.format("enum-error", enumClass.getName(), fieldName, cause);
     }
 
-    static String invalidIntValue(String inputValue)
+    public static String invalidIntValue(String inputValue)
     {
         return _formatter.format("invalid-int-value", inputValue);
     }
 
-    static String minIntValue(String inputValue, int minValue)
+    public static String minIntValue(String inputValue, int minValue)
     {
         return _formatter.format("min-int-value", inputValue, new Integer(minValue));
     }
 
-    static String maxIntValue(String inputValue, int maxValue)
+    public static String maxIntValue(String inputValue, int maxValue)
     {
         return _formatter.format("max-int-value", inputValue, new Integer(maxValue));
     }
 
-    static String errorInvokingMethod(String methodName, Object parent, Location location,
+    public static String errorInvokingMethod(String methodName, Object parent, Location location,
             Throwable cause)
     {
         return _formatter.format("error-invoking-method", new Object[]
         { methodName, parent, location, cause });
     }
 
-    static String invalidLongValue(String inputValue)
+    public static String invalidLongValue(String inputValue)
     {
         return _formatter.format("invalid-long-value", inputValue);
     }
 
-    static String minLongValue(String inputValue, long minValue)
+    public static String minLongValue(String inputValue, long minValue)
     {
         return _formatter.format("min-long-value", inputValue, new Long(minValue));
     }
 
-    static String maxLongValue(String inputValue, long maxValue)
+    public static String maxLongValue(String inputValue, long maxValue)
     {
         return _formatter.format("max-long-value", inputValue, new Long(maxValue));
     }
 
-    static String readAttributeFailure(String attributeName, Element element,
+    public static String readAttributeFailure(String attributeName, Element element,
             SchemaProcessor processor, Throwable cause)
     {
         return _formatter.format("read-attribute-failure", new Object[]
         { attributeName, processor.getElementPath(), cause });
     }
 
-    static String readContentFailure(SchemaProcessor processor, Element element, Throwable
cause)
+    public static String readContentFailure(SchemaProcessor processor, Element element, Throwable
cause)
     {
         return _formatter.format("read-content-failure", processor.getElementPath(), cause);
     }
 
-    static String resourceLocalizationError(String inputValue, Module contributingModule)
+    public static String resourceLocalizationError(String inputValue, Module contributingModule)
     {
         return _formatter.format("resource-localization-error", inputValue, contributingModule
                 .getModuleId());
     }
 
-    static String invalidInitializer(String initializer)
+    public static String invalidInitializer(String initializer)
     {
         return _formatter.format("invalid-initializer", initializer);
     }
 
-    static String noPropertyEditor(Class propertyType)
+    public static String noPropertyEditor(Class propertyType)
     {
         return _formatter.format("no-property-editor", propertyType.getName());
     }
 
-    static String smartTranslatorError(String inputValue, Class propertyType, Throwable cause)
+    public static String smartTranslatorError(String inputValue, Class propertyType, Throwable
cause)
     {
         return _formatter.format(
                 "smart-translator-error",

Modified: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/config/TestConversion.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/config/TestConversion.java?rev=431096&r1=431095&r2=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/config/TestConversion.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/config/TestConversion.java
Sat Aug 12 15:00:19 2006
@@ -20,6 +20,7 @@
 
 import org.apache.hivemind.Registry;
 import org.apache.hivemind.ServiceImplementationFactory;
+import org.apache.hivemind.xml.XmlTestCase;
 
 /**
  * Tests for the <conversion> and <map> elements
@@ -29,7 +30,7 @@
  *
  * @author Howard Lewis Ship
  */
-public class TestConversion extends FrameworkTestCase
+public class TestConversion extends XmlTestCase
 {
     public void testBasics() throws Exception
     {

Modified: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/config/TestUniqueElementAttribute.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/config/TestUniqueElementAttribute.java?rev=431096&r1=431095&r2=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/config/TestUniqueElementAttribute.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/config/TestUniqueElementAttribute.java
Sat Aug 12 15:00:19 2006
@@ -17,12 +17,13 @@
 import hivemind.test.FrameworkTestCase;
 import org.apache.hivemind.Registry;
 import org.apache.hivemind.ApplicationRuntimeException;
+import org.apache.hivemind.xml.XmlTestCase;
 
 import java.util.List;
 
 /** Test for checking the uniqueness of element attributes.
  */
-public class TestUniqueElementAttribute extends FrameworkTestCase
+public class TestUniqueElementAttribute extends XmlTestCase
 {
     /**
      * Test with unique="true"

Copied: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/ServiceTranslator.xml
(from r431063, hivemind/branches/branch-2-0-annot/framework/src/test/hivemind/test/services/ServiceTranslator.xml)
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/ServiceTranslator.xml?p2=hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/ServiceTranslator.xml&p1=hivemind/branches/branch-2-0-annot/framework/src/test/hivemind/test/services/ServiceTranslator.xml&r1=431063&r2=431096&rev=431096&view=diff
==============================================================================
    (empty)

Propchange: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/ServiceTranslator.xml
------------------------------------------------------------------------------
    cvs2svn:cvs-rev = 1.6

Propchange: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/ServiceTranslator.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/ServiceTranslator.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestConfigurationTranslator.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestConfigurationTranslator.java?rev=431096&r1=431095&r2=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestConfigurationTranslator.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestConfigurationTranslator.java
Sat Aug 12 15:00:19 2006
@@ -23,13 +23,14 @@
 import org.apache.hivemind.Registry;
 import org.apache.hivemind.internal.Module;
 import org.apache.hivemind.schema.rules.ConfigurationTranslator;
+import org.apache.hivemind.xml.XmlTestCase;
 
 /**
  * Tests for {@link org.apache.hivemind.schema.rules.ConfigurationTranslator}.
  * 
  * @author Howard Lewis Ship
  */
-public class TestConfigurationTranslator extends FrameworkTestCase
+public class TestConfigurationTranslator extends XmlTestCase
 {
 
     public void testNull()

Copied: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestCreateObjectRule.java
(from r431063, hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/TestCreateObjectRule.java)
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestCreateObjectRule.java?p2=hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestCreateObjectRule.java&p1=hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/TestCreateObjectRule.java&r1=431063&r2=431096&rev=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/TestCreateObjectRule.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestCreateObjectRule.java
Sat Aug 12 15:00:19 2006
@@ -12,12 +12,14 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package org.apache.hivemind.schema.rules;
+package hivemind.test.rules;
 
 import org.apache.hivemind.Element;
 import org.apache.hivemind.Location;
 import org.apache.hivemind.internal.Module;
 import org.apache.hivemind.schema.SchemaProcessor;
+import org.apache.hivemind.schema.rules.Bean;
+import org.apache.hivemind.schema.rules.CreateObjectRule;
 import org.apache.hivemind.test.AggregateArgumentsMatcher;
 import org.apache.hivemind.test.ArgumentMatcher;
 import org.apache.hivemind.test.HiveMindTestCase;

Propchange: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestCreateObjectRule.java
------------------------------------------------------------------------------
    cvs2svn:cvs-rev = 1.3

Propchange: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestCreateObjectRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestCreateObjectRule.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestIdTranslators.java
(from r431063, hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/TestIdTranslators.java)
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestIdTranslators.java?p2=hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestIdTranslators.java&p1=hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/TestIdTranslators.java&r1=431063&r2=431096&rev=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/TestIdTranslators.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestIdTranslators.java
Sat Aug 12 15:00:19 2006
@@ -12,10 +12,12 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package org.apache.hivemind.schema.rules;
+package hivemind.test.rules;
 
 import org.apache.hivemind.internal.Module;
 import org.apache.hivemind.schema.Translator;
+import org.apache.hivemind.schema.rules.IdListTranslator;
+import org.apache.hivemind.schema.rules.QualifiedIdTranslator;
 import org.apache.hivemind.test.HiveMindTestCase;
 import org.easymock.MockControl;
 

Propchange: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestIdTranslators.java
------------------------------------------------------------------------------
    cvs2svn:cvs-rev = 1.4

Propchange: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestIdTranslators.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestIdTranslators.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestInstanceTranslator.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestInstanceTranslator.java?rev=431096&r1=431095&r2=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestInstanceTranslator.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestInstanceTranslator.java
Sat Aug 12 15:00:19 2006
@@ -27,6 +27,7 @@
 import org.apache.hivemind.internal.Module;
 import org.apache.hivemind.schema.rules.ClassTranslator;
 import org.apache.hivemind.schema.rules.InstanceTranslator;
+import org.apache.hivemind.xml.XmlTestCase;
 
 /**
  * Fill in some gaps in {@link org.apache.hivemind.schema.rules.InstanceTranslator} and
@@ -34,7 +35,7 @@
  * 
  * @author Howard Lewis Ship
  */
-public class TestInstanceTranslator extends FrameworkTestCase
+public class TestInstanceTranslator extends XmlTestCase
 {
 
     public void testNull()

Modified: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestInvokeParentRule.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestInvokeParentRule.java?rev=431096&r1=431095&r2=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestInvokeParentRule.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestInvokeParentRule.java
Sat Aug 12 15:00:19 2006
@@ -22,9 +22,10 @@
 import org.apache.hivemind.Registry;
 import org.apache.hivemind.schema.SchemaProcessor;
 import org.apache.hivemind.schema.rules.InvokeParentRule;
+import org.apache.hivemind.xml.XmlTestCase;
 import org.easymock.MockControl;
 
-public class TestInvokeParentRule extends FrameworkTestCase
+public class TestInvokeParentRule extends XmlTestCase
 {
 
     public void testInvokeFailure() throws Exception

Copied: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestNumericTranslators.java
(from r431063, hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/TestNumericTranslators.java)
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestNumericTranslators.java?p2=hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestNumericTranslators.java&p1=hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/TestNumericTranslators.java&r1=431063&r2=431096&rev=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/TestNumericTranslators.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestNumericTranslators.java
Sat Aug 12 15:00:19 2006
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package org.apache.hivemind.schema.rules;
+package hivemind.test.rules;
 
 import hivemind.test.FrameworkTestCase;
 
@@ -20,6 +20,7 @@
 import org.apache.hivemind.schema.rules.DoubleTranslator;
 import org.apache.hivemind.schema.rules.IntTranslator;
 import org.apache.hivemind.schema.rules.LongTranslator;
+import org.apache.hivemind.schema.rules.RulesMessages;
 
 /**
  * Tests the numeric translators.

Propchange: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestNumericTranslators.java
------------------------------------------------------------------------------
    cvs2svn:cvs-rev = 1.2

Propchange: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestNumericTranslators.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestNumericTranslators.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestServiceTranslator.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestServiceTranslator.java?rev=431096&view=auto
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestServiceTranslator.java
(added)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestServiceTranslator.java
Sat Aug 12 15:00:19 2006
@@ -0,0 +1,55 @@
+// 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.
+
+package hivemind.test.rules;
+
+import hivemind.test.services.Constructed;
+import hivemind.test.services.SimpleService;
+
+import org.apache.hivemind.Registry;
+import org.apache.hivemind.service.ThreadLocalStorage;
+import org.apache.hivemind.xml.XmlTestCase;
+
+/**
+ * Tests for {@link org.apache.hivemind.schema.rules.ServiceTranslator}
+ *
+ * @author Howard Lewis Ship
+ */
+public class TestServiceTranslator extends XmlTestCase
+{
+    public void testServiceTranslator() throws Exception
+    {
+        Registry r = buildFrameworkRegistry("ServiceTranslator.xml");
+
+        SimpleService ss =
+            (SimpleService) r.getService("hivemind.test.services.Simple", SimpleService.class);
+
+        assertNotNull(ss);
+
+        ThreadLocalStorage tls =
+            (ThreadLocalStorage) r.getService(
+                "hivemind.ThreadLocalStorage",
+                ThreadLocalStorage.class);
+
+        assertNotNull(tls);
+
+        Constructed c =
+            (Constructed) r.getService("hivemind.test.services.Constructed", Constructed.class);
+
+        assertNotNull(c);
+
+        assertSame(ss, c.getSimpleService());
+        assertSame(tls, c.getThreadLocal());
+    }
+}

Modified: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestSetPropertyRule.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestSetPropertyRule.java?rev=431096&r1=431095&r2=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestSetPropertyRule.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestSetPropertyRule.java
Sat Aug 12 15:00:19 2006
@@ -18,13 +18,14 @@
 
 import org.apache.hivemind.Registry;
 import org.apache.hivemind.test.HiveMindTestCase;
+import org.apache.hivemind.xml.XmlTestCase;
 
 /**
  * Tests for the {@link org.apache.hivemind.schema.rules.SetPropertyRule}.
  *
  * @author Howard Lewis Ship
  */
-public class TestSetPropertyRule extends HiveMindTestCase
+public class TestSetPropertyRule extends XmlTestCase
 {
     public void testSuccess() throws Exception
     {

Modified: hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestInvokeFactoryServiceConstructor.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestInvokeFactoryServiceConstructor.java?rev=431096&r1=431095&r2=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestInvokeFactoryServiceConstructor.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestInvokeFactoryServiceConstructor.java
Sat Aug 12 15:00:19 2006
@@ -31,6 +31,7 @@
 import org.apache.hivemind.internal.ServicePoint;
 import org.apache.hivemind.schema.impl.SchemaImpl;
 import org.apache.hivemind.test.HiveMindTestCase;
+import org.apache.hivemind.xml.XmlTestCase;
 import org.easymock.MockControl;
 
 /**
@@ -38,7 +39,7 @@
  * 
  * @author Howard Lewis Ship
  */
-public class TestInvokeFactoryServiceConstructor extends HiveMindTestCase
+public class TestInvokeFactoryServiceConstructor extends XmlTestCase
 {
     public void testWrongNumberOfParameters()
     {

Modified: hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/service/TestBuilderFactory.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/service/TestBuilderFactory.java?rev=431096&r1=431095&r2=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/service/TestBuilderFactory.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/service/TestBuilderFactory.java
Sat Aug 12 15:00:19 2006
@@ -43,6 +43,7 @@
 import org.apache.hivemind.service.impl.BuilderParameter;
 import org.apache.hivemind.service.impl.BuilderServiceIdFacet;
 import org.apache.hivemind.test.HiveMindTestCase;
+import org.apache.hivemind.xml.XmlTestCase;
 import org.easymock.MockControl;
 
 /**
@@ -51,7 +52,7 @@
  * 
  * @author Howard Lewis Ship
  */
-public class TestBuilderFactory extends HiveMindTestCase
+public class TestBuilderFactory extends XmlTestCase
 {
     private Object execute(ServiceImplementationFactoryParameters fp, BuilderParameter p)
     {

Modified: hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/service/TestBuilderFactoryServiceModel.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/service/TestBuilderFactoryServiceModel.java?rev=431096&r1=431095&r2=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/service/TestBuilderFactoryServiceModel.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/service/TestBuilderFactoryServiceModel.java
Sat Aug 12 15:00:19 2006
@@ -20,13 +20,14 @@
 import org.apache.hivemind.HiveMind;
 import org.apache.hivemind.Registry;
 import org.apache.hivemind.service.impl.BuilderFactory;
+import org.apache.hivemind.xml.XmlTestCase;
 
 /**
  * Tests {@link org.apache.hivemind.impl.PooledServiceModel} integrated with {@link BuilderFactory}.

  *
  * @author Howard Lewis Ship
  */
-public class TestBuilderFactoryServiceModel extends FrameworkTestCase
+public class TestBuilderFactoryServiceModel extends XmlTestCase
 {
 
     /**

Modified: hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/service/TestEventLinker.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/service/TestEventLinker.java?rev=431096&r1=431095&r2=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/service/TestEventLinker.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/service/TestEventLinker.java
Sat Aug 12 15:00:19 2006
@@ -19,6 +19,7 @@
 
 import org.apache.hivemind.Registry;
 import org.apache.hivemind.test.HiveMindTestCase;
+import org.apache.hivemind.xml.XmlTestCase;
 
 /**
  * Tests for the {@link org.apache.hivemind.service.impl.EventLinkerImpl}class, used by the
@@ -26,7 +27,7 @@
  * 
  * @author Howard Lewis Ship
  */
-public class TestEventLinker extends HiveMindTestCase
+public class TestEventLinker extends XmlTestCase
 {
  
     public void testInsideBuilderFactory() throws Exception

Modified: hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/service/impl/TestBuilderFactory.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/service/impl/TestBuilderFactory.java?rev=431096&r1=431095&r2=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/service/impl/TestBuilderFactory.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/service/impl/TestBuilderFactory.java
Sat Aug 12 15:00:19 2006
@@ -25,6 +25,7 @@
 import org.apache.hivemind.test.ArgumentMatcher;
 import org.apache.hivemind.test.HiveMindTestCase;
 import org.apache.hivemind.test.TypeMatcher;
+import org.apache.hivemind.xml.XmlTestCase;
 import org.easymock.MockControl;
 
 /**
@@ -33,7 +34,7 @@
  * @author Howard M. Lewis Ship
  * @since 1.1
  */
-public class TestBuilderFactory extends HiveMindTestCase
+public class TestBuilderFactory extends XmlTestCase
 {
     /**
      * Tests for errors when actually invoking the initializer method (as opposed to an error

Modified: hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/xml/TestContains.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/xml/TestContains.java?rev=431096&r1=431095&r2=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/xml/TestContains.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/xml/TestContains.java
Sat Aug 12 15:00:19 2006
@@ -25,7 +25,7 @@
  * 
  * @author Naresh Sikha
  */
-public class TestContains extends FrameworkTestCase
+public class TestContains extends XmlTestCase
 {
     private Registry registry;
 

Modified: hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/xml/TestSubModule.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/xml/TestSubModule.java?rev=431096&r1=431095&r2=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/xml/TestSubModule.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/xml/TestSubModule.java
Sat Aug 12 15:00:19 2006
@@ -24,7 +24,7 @@
  * 
  * @author Howard Lewis Ship
  */
-public class TestSubModule extends FrameworkTestCase
+public class TestSubModule extends XmlTestCase
 {
     public void testNestedSubModule() throws Exception
     {

Modified: hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/xml/XmlTestCase.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/xml/XmlTestCase.java?rev=431096&r1=431095&r2=431096&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/xml/XmlTestCase.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/xml/XmlTestCase.java
Sat Aug 12 15:00:19 2006
@@ -14,13 +14,19 @@
 
 package org.apache.hivemind.xml;
 
+import java.util.Locale;
+
 import hivemind.test.FrameworkTestCase;
 
+import org.apache.hivemind.ClassResolver;
+import org.apache.hivemind.Registry;
 import org.apache.hivemind.Resource;
 import org.apache.hivemind.impl.DefaultErrorHandler;
+import org.apache.hivemind.impl.RegistryBuilder;
 import org.apache.hivemind.parse.DependencyDescriptor;
 import org.apache.hivemind.parse.ModuleDescriptor;
 import org.apache.hivemind.parse.XmlResourceProcessor;
+import org.apache.hivemind.test.HiveMindTestCase;
 
 /**
  * Base class for xml specific tests.
@@ -29,7 +35,40 @@
  */
 public abstract class XmlTestCase extends FrameworkTestCase
 {
+    /**
+     * Convienience method for invoking {@link #buildFrameworkRegistry(String[])} with only
a single
+     * file.
+     */
+    protected Registry buildFrameworkRegistry(String file) throws Exception
+    {
+        return buildFrameworkRegistry(new String[]
+        { file });
+    }
+
+    /**
+     * Builds a minimal registry, containing only the specified files, plus the master module
+     * descriptor (i.e., those visible on the classpath). Files are resolved using
+     * {@link HiveMindTestCase#getResource(String)}.
+     */
+    protected Registry buildFrameworkRegistry(String[] files) throws Exception
+    {
+        ClassResolver resolver = getClassResolver();
+        
+        RegistryBuilder builder = new RegistryBuilder();
+        builder.autoDetectModules();
+
+        for (int i = 0; i < files.length; i++)
+        {
+            Resource resource = getResource(files[i]);
+
+            org.apache.hivemind.impl.XmlModuleReader reader = new org.apache.hivemind.impl.XmlModuleReader(builder.getRegistryDefinition(),
+                    resolver, builder.getErrorHandler());
+            reader.readModule(resource);
+        }
 
+        return builder.constructRegistry(Locale.getDefault());
+    }
+    
     protected ModuleDescriptor parse(String file)
         throws Exception
     {



Mime
View raw message