geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwo...@apache.org
Subject svn commit: r891094 - in /geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test: ./ framework/
Date Wed, 16 Dec 2009 01:15:17 GMT
Author: rwonly
Date: Wed Dec 16 01:15:14 2009
New Revision: 891094

URL: http://svn.apache.org/viewvc?rev=891094&view=rev
Log:
more codes cleanup

Added:
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/AbstractArgumentPropertyValidator.java
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/AbstractListenerComponentValidator.java
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/AbstractServiceReferenceValidator.java
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/NonNullObjectValueValidator.java
Removed:
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/ServiceReferenceValidator.java
Modified:
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/BlueprintMBeanTest.java
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/BeanArgumentValidator.java
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/BeanPropertyValidator.java
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/ReferenceListValidator.java
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/ReferenceListenerValidator.java
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/ReferenceValidator.java
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/RegistrationListenerValidator.java

Modified: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/BlueprintMBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/BlueprintMBeanTest.java?rev=891094&r1=891093&r2=891094&view=diff
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/BlueprintMBeanTest.java
(original)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/BlueprintMBeanTest.java
Wed Dec 16 01:15:14 2009
@@ -96,7 +96,7 @@
        
        // Wait enough time for osgi framework and blueprint bundles to be set up
        System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Waiting for bundles to be set up");
-       Thread.sleep(5000);
+       Thread.sleep(10000);
        
     }
     

Added: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/AbstractArgumentPropertyValidator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/AbstractArgumentPropertyValidator.java?rev=891094&view=auto
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/AbstractArgumentPropertyValidator.java
(added)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/AbstractArgumentPropertyValidator.java
Wed Dec 16 01:15:14 2009
@@ -0,0 +1,30 @@
+package org.apache.geronimo.blueprint.jmx.test.framework;
+
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeType;
+
+import org.apache.geronimo.blueprint.jmx.BlueprintMetadataMBean;
+
+abstract class AbstractArgumentPropertyValidator extends CompositeDataValidator {
+    // if not set, means do not care about the value
+    private ObjectValueValidator objectValueValidator = null;
+    
+    public AbstractArgumentPropertyValidator(CompositeType type){
+        super(type);
+    }
+    
+    public void setObjectValueValidator(ObjectValueValidator objectValueValidator){
+        this.objectValueValidator = objectValueValidator;
+    }
+    
+    public void validate(CompositeData target){
+        super.validate(target);
+        
+        if (objectValueValidator != null){
+            Byte[] byteArrayValue = (Byte[])target.get(BlueprintMetadataMBean.VALUE);
+            CompositeData value = Util.decode(byteArrayValue);
+            
+            objectValueValidator.validate(value);
+        }
+    }
+}

Added: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/AbstractListenerComponentValidator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/AbstractListenerComponentValidator.java?rev=891094&view=auto
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/AbstractListenerComponentValidator.java
(added)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/AbstractListenerComponentValidator.java
Wed Dec 16 01:15:14 2009
@@ -0,0 +1,26 @@
+package org.apache.geronimo.blueprint.jmx.test.framework;
+
+import static junit.framework.Assert.assertNotNull;
+
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeType;
+
+import org.apache.geronimo.blueprint.jmx.BlueprintMetadataMBean;
+
+abstract class AbstractListenerComponentValidator extends CompositeDataValidator {
+    TargetValidator listenerComponentValidator = null;
+    
+    protected AbstractListenerComponentValidator(CompositeType type){
+        super(type);
+    }
+    
+    public void setTargetValidator(TargetValidator targetValidator){
+        this.listenerComponentValidator = targetValidator;
+    }
+    
+    public void validate(CompositeData target){
+        super.validate(target);
+        assertNotNull("This Validator must have a TargetValidator for listener component",
listenerComponentValidator);
+        listenerComponentValidator.validate(Util.decode((Byte[])target.get(BlueprintMetadataMBean.LISTENER_COMPONENT)));
+    }
+}

Added: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/AbstractServiceReferenceValidator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/AbstractServiceReferenceValidator.java?rev=891094&view=auto
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/AbstractServiceReferenceValidator.java
(added)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/AbstractServiceReferenceValidator.java
Wed Dec 16 01:15:14 2009
@@ -0,0 +1,36 @@
+package org.apache.geronimo.blueprint.jmx.test.framework;
+
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeType;
+
+import org.apache.geronimo.blueprint.jmx.BlueprintMetadataMBean;
+
+abstract class AbstractServiceReferenceValidator extends CompositeDataValidator implements
NonNullObjectValueValidator {
+    private List<ReferenceListenerValidator> referenceListenerValidators = new ArrayList<ReferenceListenerValidator>();
+    
+    protected AbstractServiceReferenceValidator(CompositeType type) {
+        super(type);
+    }
+    
+    public void addReferenceListenerValidator(ReferenceListenerValidator... validators){
+        for (ReferenceListenerValidator validator : validators)
+            this.referenceListenerValidators.add(validator);
+    }
+    
+    public void validate(CompositeData target){
+        super.validate(target);
+        if (referenceListenerValidators.size() != 0){
+            CompositeData[] referenceListeners = (CompositeData[])target.get(BlueprintMetadataMBean.REFERENCE_LISTENERS);
+            if ( referenceListenerValidators.size() != referenceListeners.length )
+                fail("The quantity of the listeners is not the same, expect " +referenceListenerValidators.size()+"
but got "+ referenceListeners.length);
+            for (int i=0; i<referenceListenerValidators.size(); i++)
+                referenceListenerValidators.get(i).validate(referenceListeners[i]);
+        }
+    }
+    
+}

Modified: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/BeanArgumentValidator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/BeanArgumentValidator.java?rev=891094&r1=891093&r2=891094&view=diff
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/BeanArgumentValidator.java
(original)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/BeanArgumentValidator.java
Wed Dec 16 01:15:14 2009
@@ -2,10 +2,7 @@
 
 import org.apache.geronimo.blueprint.jmx.BlueprintMetadataMBean;
 
-public class BeanArgumentValidator extends CompositeDataValidator{
-    
-    // if not set, means do not care about the value
-    private ObjectValueValidator objectValueValidator = null;
+public class BeanArgumentValidator extends AbstractArgumentPropertyValidator{
     
     public BeanArgumentValidator(int index, String valueType){
         super(BlueprintMetadataMBean.BEAN_ARGUMENT_TYPE);
@@ -13,9 +10,4 @@
         setExpectValue(BlueprintMetadataMBean.VALUE_TYPE, valueType);
     }
     
-    public void setValueValidator(ObjectValueValidator objectValueValidator){
-        this.objectValueValidator = objectValueValidator;
-    }
-    
-    
 }
\ No newline at end of file

Modified: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/BeanPropertyValidator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/BeanPropertyValidator.java?rev=891094&r1=891093&r2=891094&view=diff
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/BeanPropertyValidator.java
(original)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/BeanPropertyValidator.java
Wed Dec 16 01:15:14 2009
@@ -1,32 +1,12 @@
 package org.apache.geronimo.blueprint.jmx.test.framework;
 
-import javax.management.openmbean.CompositeData;
-
 import org.apache.geronimo.blueprint.jmx.BlueprintMetadataMBean;
 
-public class BeanPropertyValidator extends CompositeDataValidator{
-    
-    // if not set, means do not care about the value
-    private ObjectValueValidator objectValueValidator = null;
+public class BeanPropertyValidator extends AbstractArgumentPropertyValidator{
     
     public BeanPropertyValidator(String name){
         super(BlueprintMetadataMBean.BEAN_PROPERTY_TYPE);
         setExpectValue(BlueprintMetadataMBean.NAME, name);            
     }
-    
-    public void setObjectValueValidator(ObjectValueValidator objectValueValidator){
-        this.objectValueValidator = objectValueValidator;
-    }
-    
-    public void validate(CompositeData target){
-        super.validate(target);
-        
-        if (objectValueValidator != null){
-            Byte[] byteArrayValue = (Byte[])target.get(BlueprintMetadataMBean.VALUE);
-            CompositeData value = Util.decode(byteArrayValue);
-            
-            objectValueValidator.validate(value);
-        }
-    }
-    
+
 }
\ No newline at end of file

Added: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/NonNullObjectValueValidator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/NonNullObjectValueValidator.java?rev=891094&view=auto
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/NonNullObjectValueValidator.java
(added)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/NonNullObjectValueValidator.java
Wed Dec 16 01:15:14 2009
@@ -0,0 +1,5 @@
+package org.apache.geronimo.blueprint.jmx.test.framework;
+
+public interface NonNullObjectValueValidator extends ObjectValueValidator{
+
+}

Modified: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/ReferenceListValidator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/ReferenceListValidator.java?rev=891094&r1=891093&r2=891094&view=diff
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/ReferenceListValidator.java
(original)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/ReferenceListValidator.java
Wed Dec 16 01:15:14 2009
@@ -2,7 +2,7 @@
 
 import org.apache.geronimo.blueprint.jmx.BlueprintMetadataMBean;
 
-public class ReferenceListValidator extends ServiceReferenceValidator {
+public class ReferenceListValidator extends AbstractServiceReferenceValidator {
     
     public ReferenceListValidator (String interfaceName){
         super(BlueprintMetadataMBean.REFERENCE_LIST_METADATA_TYPE);

Modified: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/ReferenceListenerValidator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/ReferenceListenerValidator.java?rev=891094&r1=891093&r2=891094&view=diff
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/ReferenceListenerValidator.java
(original)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/ReferenceListenerValidator.java
Wed Dec 16 01:15:14 2009
@@ -1,29 +1,13 @@
 package org.apache.geronimo.blueprint.jmx.test.framework;
 
-import javax.management.openmbean.CompositeData;
-
-import static junit.framework.Assert.*;
-
 import org.apache.geronimo.blueprint.jmx.BlueprintMetadataMBean;
 
-public class ReferenceListenerValidator extends CompositeDataValidator {
-    
-    TargetValidator listenerComponentValidator = null;
+public class ReferenceListenerValidator extends AbstractListenerComponentValidator {
     
     public ReferenceListenerValidator(String bindMethod,String unbindMethod){
         super(BlueprintMetadataMBean.REFERENCE_LISTENER_TYPE);
         this.setExpectValue(BlueprintMetadataMBean.BIND_METHOD, bindMethod);
         this.setExpectValue(BlueprintMetadataMBean.UNBIND_METHOD, unbindMethod);
     }
-    
-    public void setTargetValidator(TargetValidator targetValidator){
-        this.listenerComponentValidator = targetValidator;
-    }
-    
-    public void validate(CompositeData target){
-        super.validate(target);
-        assertNotNull("ReferenceListenerValidator must have a TargetValidator for listener
component", listenerComponentValidator);
-        listenerComponentValidator.validate(Util.decode((Byte[])target.get(BlueprintMetadataMBean.LISTENER_COMPONENT)));
-    }
-    
+        
 }

Modified: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/ReferenceValidator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/ReferenceValidator.java?rev=891094&r1=891093&r2=891094&view=diff
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/ReferenceValidator.java
(original)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/ReferenceValidator.java
Wed Dec 16 01:15:14 2009
@@ -2,7 +2,7 @@
 
 import org.apache.geronimo.blueprint.jmx.BlueprintMetadataMBean;
 
-public class ReferenceValidator extends ServiceReferenceValidator implements TargetValidator{
+public class ReferenceValidator extends AbstractServiceReferenceValidator implements TargetValidator{
     
     public ReferenceValidator(String interfaceName, long timeout){
         super(BlueprintMetadataMBean.REFERENCE_METADATA_TYPE);

Modified: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/RegistrationListenerValidator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/RegistrationListenerValidator.java?rev=891094&r1=891093&r2=891094&view=diff
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/RegistrationListenerValidator.java
(original)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.test/src/test/java/org/apache/geronimo/blueprint/jmx/test/framework/RegistrationListenerValidator.java
Wed Dec 16 01:15:14 2009
@@ -1,29 +1,13 @@
 package org.apache.geronimo.blueprint.jmx.test.framework;
 
-import javax.management.openmbean.CompositeData;
-
-import static junit.framework.Assert.*;
-
 import org.apache.geronimo.blueprint.jmx.BlueprintMetadataMBean;
 
-public class RegistrationListenerValidator extends CompositeDataValidator {
-    
-    TargetValidator listenerComponentValidator = null;
+public class RegistrationListenerValidator extends AbstractListenerComponentValidator {
     
     public RegistrationListenerValidator(String registrationMethod,String unregistrationMethod){
         super(BlueprintMetadataMBean.REGISTRATION_LISTENER_TYPE);
         this.setExpectValue(BlueprintMetadataMBean.REGISTRATION_METHOD, registrationMethod);
         this.setExpectValue(BlueprintMetadataMBean.UNREGISTRATION_METHOD, unregistrationMethod);
     }
-    
-    public void setTargetValidator(TargetValidator targetValidator){
-        this.listenerComponentValidator = targetValidator;
-    }
-    
-    public void validate(CompositeData target){
-        super.validate(target);
-        assertNotNull("ReferenceListenerValidator must have a TargetValidator for listener
component", listenerComponentValidator);
-        listenerComponentValidator.validate(Util.decode((Byte[])target.get(BlueprintMetadataMBean.LISTENER_COMPONENT)));
-    }
-    
+      
 }



Mime
View raw message