hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject cvs commit: jakarta-hivemind/framework/src/test/org/apache/hivemind/order TestOrderer.java
Date Tue, 15 Jun 2004 20:35:56 GMT
hlship      2004/06/15 13:35:56

  Modified:    framework/src/java/org/apache/hivemind/parse
                        ParseStrings.properties DescriptorParser.java
                        ConversionDescriptor.java ParseMessages.java
               framework/src/java/org/apache/hivemind/impl
                        RegistryBuilder.java ImplStrings.properties
                        ImplMessages.java
               framework/src/test/hivemind/test/config TestConversion.java
                        TestConfigurationPoint.java
               framework/src/java/org/apache/hivemind/schema/rules
                        RulesMessages.java ReadAttributeRule.java
                        ReadContentRule.java RulesStrings.properties
                        SetPropertyRule.java
               framework/src/test/hivemind/test/rules
                        TestConfigurationTranslator.java
               framework/src/java/org/apache/hivemind/order
                        OrdererMessages.java OrdererStrings.properties
                        Orderer.java
               framework/src/test/org/apache/hivemind/order
                        TestOrderer.java
  Log:
  Split out many messages out of HiveMindMessages.properties and into per-package properties
files (more to come).
  Begin excising location-related portions of messages (as location reporting is a function
of the ErrorHandler).
  
  Revision  Changes    Path
  1.2       +2 -2      jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/ParseStrings.properties
  
  Index: ParseStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/ParseStrings.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ParseStrings.properties	10 Jun 2004 19:49:40 -0000	1.1
  +++ ParseStrings.properties	15 Jun 2004 20:35:55 -0000	1.2
  @@ -13,8 +13,8 @@
   # See the License for the specific language governing permissions and
   # limitations under the License.
   
  -dupe-attribute-mapping=Mapping for attribute {0} (at {1}) conflicts with a previous mapping
(at {2}) and has been ignored.
  -extra-mappings=Mappings for unknown attribute(s) {0} (for element {1} at {2}) have been
ignored.
  +dupe-attribute-mapping=Mapping for attribute {0} conflicts with a previous mapping (at
{1}) and has been ignored.
  +extra-mappings=Mappings for unknown attribute(s) {0} (for element {1}) have been ignored.
   unable-to-resolve-schema=Unable to resolve reference to schema ''{0}''.
   not-module=Document element should be module not {0} (at {1}).
   required-attribute=Missing required attribute ''{0}'' in element {1} (at {2}).
  
  
  
  1.19      +1 -1      jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/DescriptorParser.java
  
  Index: DescriptorParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/DescriptorParser.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- DescriptorParser.java	15 Jun 2004 13:42:34 -0000	1.18
  +++ DescriptorParser.java	15 Jun 2004 20:35:55 -0000	1.19
  @@ -1318,7 +1318,7 @@
           }
           catch (IOException ex)
           {
  -            LOG.error(ParseMessages.unableToInitialize(ex), ex);
  +            _errorHandler.error(LOG, ParseMessages.unableToInitialize(ex), null, ex);
           }
   
           initializeFromProperties(p);
  
  
  
  1.8       +10 -6     jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/ConversionDescriptor.java
  
  Index: ConversionDescriptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/ConversionDescriptor.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ConversionDescriptor.java	10 Jun 2004 19:49:40 -0000	1.7
  +++ ConversionDescriptor.java	15 Jun 2004 20:35:55 -0000	1.8
  @@ -76,7 +76,11 @@
   
           if (existing != null)
           {
  -            LOG.error(ParseMessages.dupeAttributeMapping(descriptor, existing));
  +            _errorHandler.error(
  +                LOG,
  +                ParseMessages.dupeAttributeMapping(descriptor, existing),
  +                descriptor.getLocation(),
  +                null);
   
               return;
           }
  @@ -143,11 +147,11 @@
           }
   
           if (!_attributeMappings.isEmpty())
  -            LOG.error(
  -                ParseMessages.extraMappings(
  -                    _attributeMappings.keySet(),
  -                    _elementModel,
  -                    getLocation()));
  +            _errorHandler.error(
  +                LOG,
  +                ParseMessages.extraMappings(_attributeMappings.keySet(), _elementModel),
  +                _elementModel.getLocation(),
  +                null);
       }
   
       private String constructPropertyName(String attributeName)
  
  
  
  1.3       +2 -6      jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/ParseMessages.java
  
  Index: ParseMessages.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/ParseMessages.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ParseMessages.java	10 Jun 2004 19:49:40 -0000	1.2
  +++ ParseMessages.java	15 Jun 2004 20:35:55 -0000	1.3
  @@ -42,16 +42,12 @@
           return _formatter.format(
               "dupe-attribute-mapping",
               newDescriptor.getAttributeName(),
  -            newDescriptor.getLocation(),
               existingDescriptor.getLocation());
       }
   
  -    public static String extraMappings(
  -        Collection extraNames,
  -        ElementModel model,
  -        Location location)
  +    public static String extraMappings(Collection extraNames, ElementModel model)
       {
  -        return _formatter.format("extra-mappings", extraNames, model.getElementName(),
location);
  +        return _formatter.format("extra-mappings", extraNames, model.getElementName());
       }
   
       public static String unableToResolveSchema(String schemaId)
  
  
  
  1.13      +15 -4     jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java
  
  Index: RegistryBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- RegistryBuilder.java	10 Jun 2004 19:49:39 -0000	1.12
  +++ RegistryBuilder.java	15 Jun 2004 20:35:55 -0000	1.13
  @@ -497,7 +497,11 @@
   
               if (point == null)
               {
  -                LOG.error(ImplMessages.unknownConfigurationPoint(moduleId, cd));
  +                _errorHandler.error(
  +                    LOG,
  +                    ImplMessages.unknownConfigurationPoint(moduleId, cd),
  +                    cd.getLocation(),
  +                    null);
   
                   continue;
               }
  @@ -589,8 +593,11 @@
   
           if (sep == null)
           {
  -            LOG.error(
  -                ImplMessages.unknownServicePoint(sourceModule, pointId, builder.getLocation()));
  +            _errorHandler.error(
  +                LOG,
  +                ImplMessages.unknownServicePoint(sourceModule, pointId),
  +                builder.getLocation(),
  +                null);
               return;
           }
   
  @@ -616,7 +623,11 @@
   
           if (sep == null)
           {
  -            LOG.error(ImplMessages.unknownServicePoint(sourceModule, pointId, id.getLocation()));
  +            _errorHandler.error(
  +                LOG,
  +                ImplMessages.unknownServicePoint(sourceModule, pointId),
  +                id.getLocation(),
  +                null);
   
               return;
           }
  
  
  
  1.2       +2 -2      jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ImplStrings.properties
  
  Index: ImplStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ImplStrings.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ImplStrings.properties	10 Jun 2004 19:49:39 -0000	1.1
  +++ ImplStrings.properties	15 Jun 2004 20:35:55 -0000	1.2
  @@ -32,8 +32,8 @@
   unable-to-parse=Unable to parse module deployment descriptor {0}: {1}
   unable-to-find-modules=Unable to locate HiveMind module deployment descriptors in {0}:
{1}
   duplicate-module-id=Module {0} is duplicated!  Definition in {2} has been ignored in favor
of existing definition from {1}.
  -unknown-configuration-extension-point=Module {0} has contributed to unknown configuration
extension point {1} (at {2}). The contribution has been ignored.
  -unknown-service-extension-point=Module {0} contributes to unknown service extension point
{1} (at {2}). The contribution has been ignored.
  +unknown-configuration-extension-point=Module {0} has contributed to unknown configuration
extension point {1}. The contribution has been ignored.
  +unknown-service-extension-point=Module {0} contributed to unknown service extension point
{1}. The contribution has been ignored.
   missing-service=No module has contributed a service constructor for service extension point
{0}.
   duplicate-factory=Module {0} has contributed a instance builder to service extension point
{1}, which conflicts with an existing contribution by module {2}. The duplicate contribution
has been ignored.  
   
  
  
  
  1.7       +3 -8      jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ImplMessages.java
  
  Index: ImplMessages.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ImplMessages.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ImplMessages.java	10 Jun 2004 19:49:39 -0000	1.6
  +++ ImplMessages.java	15 Jun 2004 20:35:55 -0000	1.7
  @@ -188,20 +188,15 @@
           return _formatter.format(
               "unknown-configuration-extension-point",
               moduleId,
  -            descriptor.getConfigurationId(),
  -            descriptor.getLocation());
  +            descriptor.getConfigurationId());
       }
   
  -    public static String unknownServicePoint(
  -        Module sourceModule,
  -        String pointId,
  -        Location location)
  +    public static String unknownServicePoint(Module sourceModule, String pointId)
       {
           return _formatter.format(
               "unknown-service-extension-point",
               sourceModule.getModuleId(),
  -            pointId,
  -            location);
  +            pointId);
       }
   
       public static String missingService(ServicePoint point)
  
  
  
  1.5       +3 -3      jakarta-hivemind/framework/src/test/hivemind/test/config/TestConversion.java
  
  Index: TestConversion.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/config/TestConversion.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestConversion.java	18 May 2004 15:34:01 -0000	1.4
  +++ TestConversion.java	15 Jun 2004 20:35:56 -0000	1.5
  @@ -116,7 +116,7 @@
   
           assertLoggedMessagePattern(
               "Mappings for unknown attribute\\(s\\) \\[extra\\] "
  -                + "\\(for element data-item at .*\\) have been ignored\\.");
  +                + "\\(for element data-item\\) have been ignored\\.");
   
           List l = r.getConfiguration("hivemind.test.config.ExtraAttributeNames");
   
  @@ -142,7 +142,7 @@
   		RegistryInfrastructure r = buildFrameworkRegistry("DuplicateAttribute.xml");
   
           assertLoggedMessagePattern(
  -            "Mapping for attribute item-name \\(at .*\\) conflicts with a previous "
  +            "Mapping for attribute item-name conflicts with a previous "
                   + "mapping \\(at .*\\) and has been ignored\\.");
   
           List l = r.getConfiguration("hivemind.test.config.DuplicateAttribute");
  
  
  
  1.13      +5 -5      jakarta-hivemind/framework/src/test/hivemind/test/config/TestConfigurationPoint.java
  
  Index: TestConfigurationPoint.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/config/TestConfigurationPoint.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- TestConfigurationPoint.java	10 Jun 2004 19:49:40 -0000	1.12
  +++ TestConfigurationPoint.java	15 Jun 2004 20:35:56 -0000	1.13
  @@ -169,7 +169,7 @@
           l.size();
   
           assertLoggedMessagePattern(
  -            "Unable to process attribute value \\(of element flag, at .*\\): "
  +            "Unable to process attribute value \\(of element flag\\): "
                   + "'maybe' is not a boolean value \\(which should be either 'true' or 'false'\\)\\.");
   
           assertEquals(3, l.size());
  @@ -200,7 +200,7 @@
           List events = getInterceptedLogEvents();
   
           assertLoggedMessagePattern(
  -            "Unable to process attribute value \\(of element int, at .*\\): "
  +            "Unable to process attribute value \\(of element int\\): "
                   + "Value 2 is less than minimum value 5\\.",
               events);
           assertLoggedMessagePattern("Value 12 is greater than maximum value 10\\.", events);
  @@ -470,7 +470,7 @@
           assertNull(h.getResource());
   
           assertLoggedMessagePattern(
  -            "Unable to process content of element resource \\(at .*\\): "
  +            "Unable to process content of element resource: "
                   + "Unable to localize resource DoesNotExist\\.xml for module hivemind\\.test\\.config\\.");
       }
   
  @@ -548,7 +548,7 @@
           buildFrameworkRegistry("UnknownContribution.xml");
   
           assertLoggedMessagePattern(
  -            "Module hivemind\\.test\\.config has contributed to unknown configuration extension
point UnresolvedSchema \\(at .*/UnknownContribution.xml.*?\\)\\. "
  +            "Module hivemind\\.test\\.config has contributed to unknown configuration extension
point UnresolvedSchema\\. "
                   + "The contribution has been ignored\\.");
   
       }
  
  
  
  1.3       +4 -8      jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/RulesMessages.java
  
  Index: RulesMessages.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/RulesMessages.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RulesMessages.java	10 Jun 2004 19:49:39 -0000	1.2
  +++ RulesMessages.java	15 Jun 2004 20:35:56 -0000	1.3
  @@ -51,15 +51,13 @@
                   _formatter.extractMessage(cause)});
       }
   
  -    public static String unableToSetProperty(
  -        String propertyName,
  -        Object target,
  -        Location location,
  -        Throwable cause)
  +    public static String unableToSetProperty(String propertyName, Object target, Throwable
cause)
       {
           return _formatter.format(
               "unable-to-set-property",
  -            new Object[] { propertyName, target, location, _formatter.extractMessage(cause)});
  +            propertyName,
  +            target,
  +            _formatter.extractMessage(cause));
       }
   
       public static String invalidBooleanValue(String inputValue)
  @@ -157,7 +155,6 @@
               new Object[] {
                   attributeName,
                   processor.getElementPath(),
  -                HiveMind.getLocationString(element),
                   _formatter.extractMessage(cause)});
       }
   
  @@ -169,7 +166,6 @@
           return _formatter.format(
               "read-content-failure",
               processor.getElementPath(),
  -            HiveMind.getLocationString(element),
               _formatter.extractMessage(cause));
       }
   
  
  
  
  1.10      +7 -2      jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/ReadAttributeRule.java
  
  Index: ReadAttributeRule.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/ReadAttributeRule.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ReadAttributeRule.java	15 Jun 2004 13:42:33 -0000	1.9
  +++ ReadAttributeRule.java	15 Jun 2004 20:35:56 -0000	1.10
  @@ -17,6 +17,7 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.hivemind.Element;
  +import org.apache.hivemind.ErrorHandler;
   import org.apache.hivemind.HiveMind;
   import org.apache.hivemind.Location;
   import org.apache.hivemind.schema.SchemaProcessor;
  @@ -85,8 +86,12 @@
           }
           catch (Exception ex)
           {
  -            LOG.error(
  +            ErrorHandler eh = processor.getContributingModule().getErrorHandler();
  +
  +            eh.error(
  +                LOG,
                   RulesMessages.readAttributeFailure(_attributeName, element, processor,
ex),
  +                element.getLocation(),
                   ex);
           }
   
  
  
  
  1.8       +9 -2      jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/ReadContentRule.java
  
  Index: ReadContentRule.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/ReadContentRule.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ReadContentRule.java	15 Jun 2004 13:42:33 -0000	1.7
  +++ ReadContentRule.java	15 Jun 2004 20:35:56 -0000	1.8
  @@ -17,6 +17,7 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.hivemind.Element;
  +import org.apache.hivemind.ErrorHandler;
   import org.apache.hivemind.HiveMind;
   import org.apache.hivemind.schema.SchemaProcessor;
   import org.apache.hivemind.schema.Translator;
  @@ -59,7 +60,13 @@
           }
           catch (Exception ex)
           {
  -            LOG.error(RulesMessages.readContentFailure(processor, element, ex), ex);
  +            ErrorHandler eh = processor.getContributingModule().getErrorHandler();
  +
  +            eh.error(
  +                LOG,
  +                RulesMessages.readContentFailure(processor, element, ex),
  +                element.getLocation(),
  +                ex);
           }
   
       }
  
  
  
  1.2       +3 -3      jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/RulesStrings.properties
  
  Index: RulesStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/RulesStrings.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RulesStrings.properties	10 Jun 2004 19:49:39 -0000	1.1
  +++ RulesStrings.properties	15 Jun 2004 20:35:56 -0000	1.2
  @@ -14,7 +14,7 @@
   # limitations under the License.
   
   unable-to-set-element-property=Unable to update property {0} of {1} (in element {2}, at
{3}): {4}
  -unable-to-set-property=Unable set property {0} of {1} (at {2}): {3}
  +unable-to-set-property=Unable set property {0} of {1}: {2}
   invalid-boolean-value=''{0}'' is not a boolean value (which should be either ''true'' or
''false'').
   error-creating-object=Error creating instance of class {0} (at {1}): {2}
   
  @@ -35,8 +35,8 @@
   invalid-long-value=''{0}'' is not a long value.
   min-long-value=Value {0} is less than minimum value {1}.
   max-long-value=Value {0} is greater than maximum value {1}.
  -read-attribute-failure=Unable to process attribute {0} (of element {1}, at {2}): {3}
  -read-content-failure=Unable to process content of element {0} (at {1}): {2}
  +read-attribute-failure=Unable to process attribute {0} (of element {1}): {2}
  +read-content-failure=Unable to process content of element {0}: {1}
   resource-localization-error=Unable to localize resource {0} for module {1}.
   invalid-initializer=Initializer string (''{0}'') is not in proper format (key=value[,key=value]*).
   no-property-editor=No property editor for {0}.
  
  
  
  1.4       +5 -3      jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/SetPropertyRule.java
  
  Index: SetPropertyRule.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/SetPropertyRule.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SetPropertyRule.java	15 Jun 2004 13:42:33 -0000	1.3
  +++ SetPropertyRule.java	15 Jun 2004 20:35:56 -0000	1.4
  @@ -17,6 +17,7 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.hivemind.Element;
  +import org.apache.hivemind.ErrorHandler;
   import org.apache.hivemind.schema.SchemaProcessor;
   import org.apache.hivemind.schema.Translator;
   import org.apache.hivemind.util.PropertyUtils;
  @@ -54,10 +55,11 @@
           }
           catch (Exception ex)
           {
  -            String message =
  -                RulesMessages.unableToSetProperty(_propertyName, target, element.getLocation(),
ex);
  +            ErrorHandler eh = processor.getContributingModule().getErrorHandler();
   
  -            LOG.error(message, ex);
  +            String message = RulesMessages.unableToSetProperty(_propertyName, target, ex);
  +
  +            eh.error(LOG, message, element.getLocation(), ex);
           }
   
       }
  
  
  
  1.9       +4 -3      jakarta-hivemind/framework/src/test/hivemind/test/rules/TestConfigurationTranslator.java
  
  Index: TestConfigurationTranslator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/rules/TestConfigurationTranslator.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TestConfigurationTranslator.java	25 May 2004 22:31:41 -0000	1.8
  +++ TestConfigurationTranslator.java	15 Jun 2004 20:35:56 -0000	1.9
  @@ -75,8 +75,9 @@
           h.getDatums();
   
           assertLoggedMessagePattern(
  -            "Unable to process attribute configuration-id \\(of element construct/set-configuration,
at "
  -                + ".*\\): Configuration point hivemind\\.test\\.rules\\.missing does not
exist\\.");
  +            "Unable to process attribute configuration-id "
  +                + "\\(of element construct/set-configuration\\): "
  +                + "Configuration point hivemind\\.test\\.rules\\.missing does not exist\\.");
   
           assertNull(h.getDatums());
       }
  
  
  
  1.3       +1 -7      jakarta-hivemind/framework/src/java/org/apache/hivemind/order/OrdererMessages.java
  
  Index: OrdererMessages.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/order/OrdererMessages.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- OrdererMessages.java	15 Jun 2004 19:26:37 -0000	1.2
  +++ OrdererMessages.java	15 Jun 2004 20:35:56 -0000	1.3
  @@ -98,13 +98,7 @@
           String dependencyName,
           ObjectOrdering ordering)
       {
  -        return _formatter.format(
  -            "bad-dependency",
  -            new Object[] {
  -                objectType,
  -                dependencyName,
  -                ordering.getName(),
  -                HiveMind.getLocationString(ordering.getObject())});
  +        return _formatter.format("bad-dependency", objectType, dependencyName, ordering.getName());
   
       }
   
  
  
  
  1.2       +1 -1      jakarta-hivemind/framework/src/java/org/apache/hivemind/order/OrdererStrings.properties
  
  Index: OrdererStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/order/OrdererStrings.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- OrdererStrings.properties	15 Jun 2004 19:26:37 -0000	1.1
  +++ OrdererStrings.properties	15 Jun 2004 20:35:56 -0000	1.2
  @@ -14,7 +14,7 @@
   # limitations under the License.
   
   duplicate-name={0} ''{1}'' (at {2}) duplicates previous value (at {3}) and is being ignored.
  -bad-dependency=Unknown {0} dependency ''{1}'' (for ''{2}'', at {3}).
  +bad-dependency=Unknown {0} dependency ''{1}'' (for ''{2}'').
   dependency-cycle=Unable to order {0} ''{1}'' due to dependency cycle: {2}
   exception=Unable to order {0}s: {1}
   dupe-leader={0} ''{1}'' (at {2}) has been ordered first, conflicting with ''{3}'' (at {4}).
  
  
  
  1.6       +26 -20    jakarta-hivemind/framework/src/java/org/apache/hivemind/order/Orderer.java
  
  Index: Orderer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/order/Orderer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Orderer.java	15 Jun 2004 19:26:37 -0000	1.5
  +++ Orderer.java	15 Jun 2004 20:35:56 -0000	1.6
  @@ -226,7 +226,7 @@
                       _errorHandler.error(
                           _log,
                           OrdererMessages.dupeLeader(_objectType, o, getOrderable(_leader.getName())),
  -					HiveMind.getLocation(o.getObject()),
  +                        HiveMind.getLocation(o.getObject()),
                           null);
                   }
               }
  @@ -312,28 +312,30 @@
   
               if (pregoal == null)
               {
  -                _log.error(OrdererMessages.badDependency(_objectType, prename, ordering));
  +                _errorHandler.error(
  +                    _log,
  +                    OrdererMessages.badDependency(_objectType, prename, ordering),
  +                    HiveMind.getLocation(ordering.getObject()),
  +                    null);
  +                continue;
               }
  -            else
  -            {
   
  -                try
  -                {
  -                    goal.addPrecursor(pregoal);
  -                }
  -                catch (CyclicGoalChainException ex)
  -                {
  -                    String name = goal.getName();
  -                    ObjectOrdering trigger = getOrderable(name);
  -
  -                    _errorHandler.error(
  -                        _log,
  -                        OrdererMessages.dependencyCycle(_objectType, trigger, ex),
  -                        HiveMind.getLocation(trigger.getObject()),
  -                        ex);
  -                }
  +            try
  +            {
  +                goal.addPrecursor(pregoal);
  +            }
  +            catch (CyclicGoalChainException ex)
  +            {
  +                String name = goal.getName();
  +                ObjectOrdering trigger = getOrderable(name);
   
  +                _errorHandler.error(
  +                    _log,
  +                    OrdererMessages.dependencyCycle(_objectType, trigger, ex),
  +                    HiveMind.getLocation(trigger.getObject()),
  +                    ex);
               }
  +
           }
       }
   
  @@ -355,7 +357,11 @@
   
               if (postgoal == null)
               {
  -                _log.error(OrdererMessages.badDependency(_objectType, postname, ordering));
  +                _errorHandler.error(
  +                    _log,
  +                    OrdererMessages.badDependency(_objectType, postname, ordering),
  +                    HiveMind.getLocation(ordering.getObject()),
  +                    null);
               }
               else
               {
  
  
  
  1.4       +23 -14    jakarta-hivemind/framework/src/test/org/apache/hivemind/order/TestOrderer.java
  
  Index: TestOrderer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/test/org/apache/hivemind/order/TestOrderer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestOrderer.java	15 Jun 2004 19:26:38 -0000	1.3
  +++ TestOrderer.java	15 Jun 2004 20:35:56 -0000	1.4
  @@ -114,49 +114,58 @@
   
       public void testUnknownPrereq() throws Exception
       {
  -        Orderer o = new Orderer(new DefaultErrorHandler(), "cartoon character");
  +        MockControl c = MockControl.createStrictControl(ErrorHandler.class);
  +        ErrorHandler eh = (ErrorHandler) c.getMock();
  +
  +        eh.error(LOG, "Unknown cartoon character dependency 'charlie' (for 'fred').", null,
null);
  +
  +        c.replay();
  +
  +        Orderer o = new Orderer(LOG, eh, "cartoon character");
   
           o.add("FRED", "fred", "charlie", "barney,wilma");
           o.add("BARNEY", "barney", "wilma", "betty");
           o.add("BETTY", "betty", null, null);
           o.add("WILMA", "wilma", null, null);
   
  -        interceptLogging();
  -
           List l = o.getOrderedObjects();
   
           assertListsEqual(new Object[] { "FRED", "WILMA", "BARNEY", "BETTY" }, l);
   
  -        assertLoggedMessage("Unknown cartoon character dependency 'charlie' (for 'fred',
at unknown location).");
  -
  +        c.verify();
       }
   
       public void testUnknownPostreq() throws Exception
       {
  -        Orderer o = new Orderer(new DefaultErrorHandler(), "cartoon character");
  +        MockControl c = MockControl.createStrictControl(ErrorHandler.class);
  +        ErrorHandler eh = (ErrorHandler) c.getMock();
  +
  +        eh.error(LOG, "Unknown cartoon character dependency 'dino' (for 'betty').", null,
null);
  +
  +        c.replay();
  +
  +        Orderer o = new Orderer(LOG, eh, "cartoon character");
   
           o.add("FRED", "fred", null, "barney,wilma");
           o.add("BARNEY", "barney", "wilma", "betty");
           o.add("BETTY", "betty", null, "dino");
           o.add("WILMA", "wilma", null, null);
   
  -        interceptLogging();
  -
           List l = o.getOrderedObjects();
   
           assertListsEqual(new Object[] { "FRED", "WILMA", "BARNEY", "BETTY" }, l);
   
  -        assertLoggedMessage("Unknown cartoon character dependency 'dino' (for 'betty',
at unknown location).");
  +        c.verify();
       }
   
       private static class ExceptionAwareArgumentsMatcher extends AbstractMatcher
       {
  -        protected boolean argumentMatches(Object arg0, Object arg1)
  +        protected boolean argumentMatches(Object expected, Object actual)
           {
  -            if (arg0 instanceof Throwable)
  -                return arg0.getClass().equals(arg1.getClass());
  +            if (expected instanceof Throwable)
  +                return expected.getClass().equals(actual.getClass());
   
  -            return super.argumentMatches(arg0, arg1);
  +            return super.argumentMatches(expected, actual);
           }
   
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-cvs-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-cvs-help@jakarta.apache.org


Mime
View raw message