dev@glassfish.java.net

pom updates and test fix

From: Justin Lee <Justin.Lee_at_Sun.COM>
Date: Wed, 22 Apr 2009 13:39:00 -0400

Attached are the diffs for integrating the new version of grizzly-config
that should hopefully fix the open issues against it. There is also a
fix for a test that broke from the grizzly-config merge last week.


Index: ../admin/config-api/src/test/java/com/sun/enterprise/configapi/tests/TransactionCallBackTest.java
===================================================================
--- ../admin/config-api/src/test/java/com/sun/enterprise/configapi/tests/TransactionCallBackTest.java (revision 26483)
+++ ../admin/config-api/src/test/java/com/sun/enterprise/configapi/tests/TransactionCallBackTest.java Mon Apr 13 11:00:28 EDT 2009
@@ -38,20 +38,16 @@
 
 import com.sun.grizzly.config.dom.NetworkListener;
 import com.sun.grizzly.config.dom.NetworkListeners;
-import org.glassfish.api.admin.config.Property;
 import org.glassfish.tests.utils.Utils;
 import org.jvnet.hk2.component.Habitat;
 import org.jvnet.hk2.config.ConfigBean;
 import org.jvnet.hk2.config.ConfigSupport;
 import org.jvnet.hk2.config.TransactionFailure;
 import org.jvnet.hk2.config.WriteableView;
-import org.junit.Ignore;
 
-import java.beans.PropertyVetoException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -59,7 +55,6 @@
  * Date: Mar 28, 2008
  * Time: 4:23:31 PM
  */
-_at_Ignore
 public class TransactionCallBackTest extends ConfigPersistence {
 
     Habitat habitat = Utils.getNewHabitat(this);
@@ -79,9 +74,7 @@
         return habitat;
     }
 
- @Ignore
     public void doTest() throws TransactionFailure {
-/*
         ConfigBean serviceBean = (ConfigBean) ConfigBean.unwrap(habitat.getComponent(NetworkListeners.class));
         Map<String, String> configChanges = new HashMap<String, String>();
         configChanges.put("name", "funky-listener");
@@ -90,42 +83,26 @@
                 new ConfigSupport.TransactionCallBack<WriteableView>() {
                     @SuppressWarnings({"unchecked"})
                     public void performOn(WriteableView param) throws TransactionFailure {
- try {
- // if you know the type...
- NetworkListener listener = param.getProxy(NetworkListener.class);
+ // if you know the type...
+ NetworkListener listener = param.getProxy(NetworkListener.class);
- Property prop = param.allocateProxy(Property.class);
- prop.setName("Julien");
- prop.setValue("Le petit Clown");
- listener.getProperty().add(prop);
-
+ listener.setName("Aleksey");
- // if you don't know the type
- Method m;
- try {
+ // if you don't know the type
+ Method m;
+ try {
- m = param.getProxyType().getMethod("getProperty");
+ m = param.getProxyType().getMethod("setAddress", String.class);
+ m.invoke(param.getProxy(param.getProxyType()), "localhost");
- } catch (NoSuchMethodException e) {
- throw new TransactionFailure("Cannot find getProperty method", e);
+ } catch (NoSuchMethodException e) {
+ throw new TransactionFailure("Cannot find getProperty method", e);
- }
- Property prop2 = param.allocateProxy(Property.class);
- prop2.setName("Aleksey");
- prop2.setValue("Le petit blond");
- try {
- List<Property> list = (List<Property>) m.invoke(param.getProxy(param.getProxyType()));
- list.add(prop2);
- } catch (IllegalAccessException e) {
- throw new TransactionFailure("Cannot call getProperty method", e);
- } catch (InvocationTargetException e) {
- throw new TransactionFailure("Cannot call getProperty method", e);
- }
+ } catch (IllegalAccessException e) {
+ throw new TransactionFailure("Cannot call getProperty method", e);
+ } catch (InvocationTargetException e) {
+ throw new TransactionFailure("Cannot call getProperty method", e);
+ }
- } catch(PropertyVetoException e) {
- throw new TransactionFailure("Cannot add property to listener", e);
- }
+ }
-
- }
                 });
-*/
     }
 
     public boolean assertResult(String s) {
- return s.contains("Aleksey");
+ return s.contains("Aleksey") && s.contains("localhost");
     }
 }
Index: ../distributions/nucleus-base/domains/domain1/config/domain.xml
===================================================================
--- ../distributions/nucleus-base/domains/domain1/config/domain.xml (revision 26483)
+++ ../distributions/nucleus-base/domains/domain1/config/domain.xml Tue Apr 21 17:51:21 EDT 2009
@@ -148,9 +148,6 @@
         <jvm-options>-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-options>
         <jvm-options>-XX:NewRatio=2</jvm-options>
       </java-config>
- <thread-pools>
- <thread-pool thread-pool-id="thread-pool-1"></thread-pool>
- </thread-pools>
       <network-config>
         <protocols>
           <protocol name="http-listener-1">
@@ -172,6 +169,7 @@
         </protocols>
         <network-listeners>
           <thread-pool max-thread-pool-size="20" min-thread-pool-size="2" thread-pool-id="http-thread-pool" max-queue-size="4096"></thread-pool>
+ <thread-pool thread-pool-id="thread-pool-1"></thread-pool>
           <network-listener port="8080" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>
           <network-listener port="8181" enabled="false" protocol="http-listener-2" transport="tcp" name="http-listener-2" thread-pool="http-thread-pool"></network-listener>
           <network-listener port="4848" protocol="admin-listener" transport="tcp" name="admin-listener" thread-pool="http-thread-pool"></network-listener>
Index: ../distributions/nucleus-base/lib/templates/domain.xml
===================================================================
--- ../distributions/nucleus-base/lib/templates/domain.xml (revision 26483)
+++ ../distributions/nucleus-base/lib/templates/domain.xml Tue Apr 21 17:51:05 EDT 2009
@@ -150,9 +150,6 @@
         <jvm-options>-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-options>
         <jvm-options>-XX:NewRatio=2</jvm-options>
       </java-config>
- <thread-pools>
- <thread-pool thread-pool-id="thread-pool-1" />
- </thread-pools>
       <network-config>
         <protocols>
           <protocol name="http-listener-1">
@@ -174,6 +171,7 @@
         </protocols>
         <network-listeners>
           <thread-pool max-thread-pool-size="20" min-thread-pool-size="2" thread-pool-id="http-thread-pool" max-queue-size="4096"></thread-pool>
+ <thread-pool thread-pool-id="thread-pool-1"/>
           <network-listener port="%%%HTTP_PORT%%%" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>
           <network-listener port="%%%HTTP_SSL_PORT%%%" enabled="false" protocol="http-listener-2" transport="tcp" name="http-listener-2" thread-pool="http-thread-pool"></network-listener>
           <network-listener port="%%%ADMIN_PORT%%%" protocol="admin-listener" transport="tcp" name="admin-listener" thread-pool="http-thread-pool"></network-listener>
Index: ../pom.xml
===================================================================
--- ../pom.xml (revision 26483)
+++ ../pom.xml Tue Apr 21 16:40:17 EDT 2009
@@ -110,6 +110,7 @@
         <deployment-api.version>1.2-rev-1</deployment-api.version>
         <jaxrpc-api.version>1.1</jaxrpc-api.version>
         <grizzly.version>1.9.14</grizzly.version>
+ <grizzly-config.version>1.0.0</grizzly-config.version>
         <jaxb-api.version>2.1</jaxb-api.version>
         <jaxws-api.version>2.1</jaxws-api.version>
         <jsr250-api.version>1.0</jsr250-api.version>
@@ -743,7 +744,7 @@
             <dependency>
                 <groupId>com.sun.grizzly</groupId>
                 <artifactId>grizzly-config</artifactId>
- <version>${grizzly.version}</version>
+ <version>${grizzly-config.version}</version>
             </dependency>
 
             <dependency>