tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject cvs commit: jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/parse TestSpecificationParser.java
Date Tue, 02 Nov 2004 13:30:00 GMT
hlship      2004/11/02 05:30:00

  Modified:    framework/src/java/org/apache/tapestry/enhance
                        EnhanceMessages.java InjectWorker.java
                        EnhancementOperation.java EnhanceStrings.properties
                        EnhancementOperationImpl.java
               framework/src/test/org/apache/tapestry/enhance
                        TestEnhancementOperation.java TestInjectWorker.java
               framework/src/java/org/apache/tapestry/spec
                        InjectSpecification.java
                        InjectSpecificationImpl.java
               framework/src/java/org/apache/tapestry/parse
                        SpecificationParser.java
               framework/src/test/org/apache/tapestry/junit/parse
                        TestSpecificationParser.java
  Log:
  Fix some incorrect terminology ("locator" should be "objectReference") and remove some dead
code.
  
  Revision  Changes    Path
  1.7       +4 -24     jakarta-tapestry/framework/src/java/org/apache/tapestry/enhance/EnhanceMessages.java
  
  Index: EnhanceMessages.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/enhance/EnhanceMessages.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- EnhanceMessages.java	2 Nov 2004 03:32:42 -0000	1.6
  +++ EnhanceMessages.java	2 Nov 2004 13:30:00 -0000	1.7
  @@ -38,21 +38,11 @@
           { method, declareClass.getName(), className, enhancedClass.getName() });
       }
   
  -    public static String codeGenerationError(String className, Throwable cause)
  -    {
  -        return _formatter.format("code-generation-error", className, cause);
  -    }
  -
       public static String unabelToIntrospectClass(Class targetClass, Throwable cause)
       {
           return _formatter.format("unable-to-introspect-class", targetClass.getName(), cause);
       }
   
  -    public static String badPropertyType(String type, Throwable cause)
  -    {
  -        return _formatter.format("bad-property-type", type, cause);
  -    }
  -
       public static String propertyTypeMismatch(Class componentClass, String propertyName,
               Class actualPropertyType, Class expectedPropertyType)
       {
  @@ -62,16 +52,6 @@
                   ClassFabUtils.getJavaClassName(expectedPropertyType) });
       }
   
  -    public static String nonAbstractWrite(Class declaringClass, String propertyName)
  -    {
  -        return _formatter.format("non-abstract-write", declaringClass.getName(), propertyName);
  -    }
  -
  -    public static String nonAbstractRead(Class declaringClass, String propertyName)
  -    {
  -        return _formatter.format("non-abstract-read", declaringClass.getName(), propertyName);
  -    }
  -
       public static String autoMustBeRequired(String propertyName)
       {
           return _formatter.format("auto-must-be-required", propertyName);
  @@ -102,14 +82,14 @@
           return _formatter.format("missing-constructor", baseClass.getName());
       }
   
  -    public static String locatedValueIsNull(String locator)
  +    public static String locatedValueIsNull(String objectReference)
       {
  -        return _formatter.format("located-value-is-null", locator);
  +        return _formatter.format("located-value-is-null", objectReference);
       }
   
       public static String incompatibleInjectType(String locator, Object value, Class propertyType)
       {
  -        return _formatter
  -                .format("incompatible-inject-type", locator, value, propertyType.getName());
  +        return _formatter.format("incompatible-inject-type", locator, value, ClassFabUtils
  +                .getJavaClassName(propertyType));
       }
   }
  
  
  
  1.2       +4 -4      jakarta-tapestry/framework/src/java/org/apache/tapestry/enhance/InjectWorker.java
  
  Index: InjectWorker.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/enhance/InjectWorker.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InjectWorker.java	2 Nov 2004 03:32:42 -0000	1.1
  +++ InjectWorker.java	2 Nov 2004 13:30:00 -0000	1.2
  @@ -64,7 +64,7 @@
       private void performEnhancement(EnhancementOperation op, InjectSpecification is)
       {
           String name = is.getName();
  -        String locator = is.getLocator();
  +        String objectReference = is.getObjectReference();
   
           Class propertyType = op.getPropertyType(name);
           if (propertyType == null)
  @@ -74,14 +74,14 @@
   
           op.claimProperty(name);
   
  -        Object injectedValue = _provider.obtainValue(locator, is.getLocation());
  +        Object injectedValue = _provider.obtainValue(objectReference, is.getLocation());
   
           if (injectedValue == null)
  -            throw new ApplicationRuntimeException(EnhanceMessages.locatedValueIsNull(locator));
  +            throw new ApplicationRuntimeException(EnhanceMessages.locatedValueIsNull(objectReference));
   
           if (!propertyType.isAssignableFrom(injectedValue.getClass()))
               throw new ApplicationRuntimeException(EnhanceMessages.incompatibleInjectType(
  -                    locator,
  +                    objectReference,
                       injectedValue,
                       propertyType));
   
  
  
  
  1.5       +0 -2      jakarta-tapestry/framework/src/java/org/apache/tapestry/enhance/EnhancementOperation.java
  
  Index: EnhancementOperation.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/enhance/EnhancementOperation.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- EnhancementOperation.java	2 Nov 2004 03:32:42 -0000	1.4
  +++ EnhancementOperation.java	2 Nov 2004 13:30:00 -0000	1.5
  @@ -14,8 +14,6 @@
   
   package org.apache.tapestry.enhance;
   
  -import java.beans.PropertyDescriptor;
  -
   import org.apache.hivemind.service.MethodSignature;
   import org.apache.tapestry.spec.IComponentSpecification;
   
  
  
  
  1.6       +0 -6      jakarta-tapestry/framework/src/java/org/apache/tapestry/enhance/EnhanceStrings.properties
  
  Index: EnhanceStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/enhance/EnhanceStrings.properties,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EnhanceStrings.properties	2 Nov 2004 03:32:42 -0000	1.5
  +++ EnhanceStrings.properties	2 Nov 2004 13:30:00 -0000	1.6
  @@ -13,15 +13,9 @@
   # limitations under the License.
   
   no-impl-for-abstract-method=Method ''{0}'' (declared in class {1}) has no implementation
in class {2} (or enhanced subclass {3}).
  -code-generation-error=A code generation error occured while enhancing class {0}: {1}
  -
  -bad-property-type=Unable to convert ''{0}'' to a property type: {1}
   property-type-mismatch=Unable to enhance class {0} because it contains property ''{1}''
of type {2}, not the expected type {3}.
  -non-abstract-read=Unable to enhance class {0} because it implements a non-abstract read
method for property ''{1}''.
  -non-abstract-write=Unable to enhance class {0} because it implements a non-abstract write
method for property ''{1}''.
   unable-to-introspect-class=Unable to introspect properties of class {0}: {1}
   auto-must-be-required=Parameter ''{0}'' must be required or have a default value as it
uses direction ''auto''.
  -
   error-adding-property=Error adding property ''{0}'' to class {1}: {2}
   claimed-property=Property ''{0}'' has already been claimed by a different enhancement worker.
   instantiation-failure=Unable to instantiate instance of class {0}: {1}
  
  
  
  1.5       +0 -2      jakarta-tapestry/framework/src/java/org/apache/tapestry/enhance/EnhancementOperationImpl.java
  
  Index: EnhancementOperationImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/enhance/EnhancementOperationImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- EnhancementOperationImpl.java	2 Nov 2004 03:32:42 -0000	1.4
  +++ EnhancementOperationImpl.java	2 Nov 2004 13:30:00 -0000	1.5
  @@ -100,8 +100,6 @@
   
       private void introspectBaseClass()
       {
  -        // TODO: Need some kind of JVM lock here on Introspection!
  -
           try
           {
               synchronized (HiveMind.INTROSPECTOR_MUTEX)
  
  
  
  1.4       +24 -2     jakarta-tapestry/framework/src/test/org/apache/tapestry/enhance/TestEnhancementOperation.java
  
  Index: TestEnhancementOperation.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/enhance/TestEnhancementOperation.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestEnhancementOperation.java	2 Nov 2004 03:32:42 -0000	1.3
  +++ TestEnhancementOperation.java	2 Nov 2004 13:30:00 -0000	1.4
  @@ -390,10 +390,32 @@
   
           assertEquals(Map.class, eo.getPropertyType("assets"));
           assertEquals(IPage.class, eo.getPropertyType("page"));
  -        
  +
           // Doesn't exist, so returns null
  -        
  +
           assertNull(eo.getPropertyType("foosball"));
  +
  +        verifyControls();
  +    }
  +
  +    public void testForceEnhancement()
  +    {
  +        IComponentSpecification spec = (IComponentSpecification) newMock(IComponentSpecification.class);
  +        MockControl cfc = newControl(ClassFactory.class);
  +        ClassFactory cf = (ClassFactory) cfc.getMock();
  +
  +        ClassFab fab = (ClassFab) newMock(ClassFab.class);
  +
  +        cf.newClass("$BaseComponent_97", BaseComponent.class, Thread.currentThread()
  +                .getContextClassLoader());
  +        cfc.setReturnValue(fab);
  +
  +        replayControls();
  +
  +        EnhancementOperation eo = new EnhancementOperationImpl(new DefaultClassResolver(),
spec,
  +                BaseComponent.class, cf);
  +
  +        eo.forceEnhancement();
   
           verifyControls();
       }
  
  
  
  1.2       +1 -1      jakarta-tapestry/framework/src/test/org/apache/tapestry/enhance/TestInjectWorker.java
  
  Index: TestInjectWorker.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/enhance/TestInjectWorker.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestInjectWorker.java	2 Nov 2004 03:32:42 -0000	1.1
  +++ TestInjectWorker.java	2 Nov 2004 13:30:00 -0000	1.2
  @@ -47,7 +47,7 @@
           InjectSpecification is = new InjectSpecificationImpl();
   
           is.setName(name);
  -        is.setLocator(locator);
  +        is.setObjectReference(locator);
           is.setLocation(location);
   
           return Collections.singletonList(is);
  
  
  
  1.2       +4 -3      jakarta-tapestry/framework/src/java/org/apache/tapestry/spec/InjectSpecification.java
  
  Index: InjectSpecification.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/spec/InjectSpecification.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InjectSpecification.java	2 Nov 2004 03:32:43 -0000	1.1
  +++ InjectSpecification.java	2 Nov 2004 13:30:00 -0000	1.2
  @@ -31,10 +31,11 @@
       public void setName(String name);
   
       /**
  -     * Returns the locator of the object to be injected into the property.
  +     * Returns the object reference used to locate the HiveMind object to be injected into
the
  +     * enhanced class.
        */
   
  -    public String getLocator();
  +    public String getObjectReference();
   
  -    public void setLocator(String name);
  +    public void setObjectReference(String name);
   }
  
  
  
  1.2       +5 -5      jakarta-tapestry/framework/src/java/org/apache/tapestry/spec/InjectSpecificationImpl.java
  
  Index: InjectSpecificationImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/spec/InjectSpecificationImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InjectSpecificationImpl.java	2 Nov 2004 03:32:43 -0000	1.1
  +++ InjectSpecificationImpl.java	2 Nov 2004 13:30:00 -0000	1.2
  @@ -24,16 +24,16 @@
   {
       private String _name;
   
  -    private String _locator;
  +    private String _objectReference;
   
  -    public String getLocator()
  +    public String getObjectReference()
       {
  -        return _locator;
  +        return _objectReference;
       }
   
  -    public void setLocator(String locator)
  +    public void setObjectReference(String locator)
       {
  -        _locator = locator;
  +        _objectReference = locator;
       }
   
       public String getName()
  
  
  
  1.9       +2 -2      jakarta-tapestry/framework/src/java/org/apache/tapestry/parse/SpecificationParser.java
  
  Index: SpecificationParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/parse/SpecificationParser.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SpecificationParser.java	2 Nov 2004 03:32:42 -0000	1.8
  +++ SpecificationParser.java	2 Nov 2004 13:30:00 -0000	1.9
  @@ -1306,12 +1306,12 @@
       private void enterInject()
       {
           String name = getValidatedAttribute("name", PROPERTY_NAME_PATTERN, "invalid-property-name");
  -        String locator = getAttribute("object");
  +        String objectReference = getAttribute("object");
   
           InjectSpecification spec = _factory.createInjectSpecification();
   
           spec.setName(name);
  -        spec.setLocator(locator);
  +        spec.setObjectReference(objectReference);
           IComponentSpecification cs = (IComponentSpecification) peekObject();
   
           cs.addInjectSpecification(spec);
  
  
  
  1.3       +2 -2      jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/parse/TestSpecificationParser.java
  
  Index: TestSpecificationParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/parse/TestSpecificationParser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestSpecificationParser.java	2 Nov 2004 03:32:43 -0000	1.2
  +++ TestSpecificationParser.java	2 Nov 2004 13:30:00 -0000	1.3
  @@ -839,12 +839,12 @@
           InjectSpecification i1 = (InjectSpecification) l.get(0);
   
           assertEquals("fred", i1.getName());
  -        assertEquals("flintstone", i1.getLocator());
  +        assertEquals("flintstone", i1.getObjectReference());
           assertNotNull(i1.getLocation());
   
           InjectSpecification i2 = (InjectSpecification) l.get(1);
           assertEquals("barney", i2.getName());
  -        assertEquals("rubble", i2.getLocator());
  +        assertEquals("rubble", i2.getObjectReference());
           assertNotNull(i2.getLocation());
       }
       
  
  
  

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


Mime
View raw message