[jboss-cvs] JBossAS SVN: r110445 - in branches/JBPAPP_5_1_datagrid/testsuite: imports/config and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jan 25 16:06:15 EST 2011


Author: rachmatowicz at jboss.com
Date: 2011-01-25 16:06:14 -0500 (Tue, 25 Jan 2011)
New Revision: 110445

Added:
   branches/JBPAPP_5_1_datagrid/testsuite/src/main/org/jboss/test/cluster/datagrid/test/DeploymentTestCase.java
Modified:
   branches/JBPAPP_5_1_datagrid/testsuite/imports/config/tests-clustering.xml
   branches/JBPAPP_5_1_datagrid/testsuite/imports/server-config.xml
Log:
Add EDG DeploymentTestCase

Modified: branches/JBPAPP_5_1_datagrid/testsuite/imports/config/tests-clustering.xml
===================================================================
--- branches/JBPAPP_5_1_datagrid/testsuite/imports/config/tests-clustering.xml	2011-01-25 21:04:19 UTC (rev 110444)
+++ branches/JBPAPP_5_1_datagrid/testsuite/imports/config/tests-clustering.xml	2011-01-25 21:06:14 UTC (rev 110445)
@@ -987,8 +987,11 @@
   <patternset id="cluster.datagrid.includes">
 	<include name="org/jboss/test/cluster/datagrid/**/*TestCase.class"/>
   </patternset>
+
+  <patternset id="cluster.datagrid.startup.includes">
+	<include name="org/jboss/test/cluster/datagrid/**/DeploymentTestCase.class"/>
+  </patternset>	
 	
-	
   <!-- Depending on the value of Infinispan config ??? -->
   <target name="tests-clustering-datagrid" description="Execute datagrid tests requiring two nodes.">
 
@@ -1006,7 +1009,7 @@
    <server:start name="datagrid-1"/>
 
    <antcall target="tests-clustering-datagrid-execute">
-     <param name="cluster.datagrid.includes.refid" value="${cluster.datagrid.includes}"/>
+     <param name="cluster.datagrid.includes.refid" value="cluster.datagrid.includes"/>
      <param name="jboss-junit-configuration" value="datagrid"/>
    </antcall>
 
@@ -1016,13 +1019,42 @@
   </target>	
 	
 	
+  <target name="tests-clustering-datagrid-startup-tests" description="Starts servers, stops servers, checks logs">
+
+	<antcall target="tests-clustering-datagrid-startup-configure" inheritRefs="true"/>	
+	  	
+	<server:start name="datagrid-startup-0"/>
+	<server:start name="datagrid-startup-1"/>
+
+  	<sleep seconds="10"/>
+  	
+	<server:stop name="datagrid-startup-1"/>
+	<server:stop name="datagrid-startup-0"/>
+
+  	<!-- after the servers have been started and stopped, run a test which checks the logs -->
+	<antcall target="tests-clustering-datagrid-execute">
+	  <param name="cluster.datagrid.includes.refid" value="cluster.datagrid.startup.includes"/>
+	  <param name="jboss-junit-configuration" value="datagrid"/>
+	</antcall>
+  	
+  </target>	
+
+	
   <target name="tests-clustering-datagrid-configure" description="Configures datagrid server nodes">
   	<property name="baseconf" value="datagrid"/>
 	 <create-cluster-node-from-baseconf conf="datagrid-0" baseconf="${baseconf}"/>
 	 <create-cluster-node-from-baseconf conf="datagrid-1" baseconf="${baseconf}"/>
   	 <!-- add in any other configuration steps here -->
   </target>	
+
+  <target name="tests-clustering-datagrid-startup-configure" description="Configures datagrid server nodes">
+	<property name="baseconf" value="datagrid"/>
+	<create-cluster-node-from-baseconf conf="datagrid-startup-0" baseconf="${baseconf}"/>
+	<create-cluster-node-from-baseconf conf="datagrid-startup-1" baseconf="${baseconf}"/>
+	<!-- add in any other configuration steps here -->
+  </target>	
 	
+	
   <!-- Executes a set of tests in a datagrid environment -->  
   <target name="tests-clustering-datagrid-execute" description="JUnit task to execute a batch of tests against the datagrid">
 	   	

Modified: branches/JBPAPP_5_1_datagrid/testsuite/imports/server-config.xml
===================================================================
--- branches/JBPAPP_5_1_datagrid/testsuite/imports/server-config.xml	2011-01-25 21:04:19 UTC (rev 110444)
+++ branches/JBPAPP_5_1_datagrid/testsuite/imports/server-config.xml	2011-01-25 21:06:14 UTC (rev 110445)
@@ -1396,8 +1396,10 @@
        <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
        <sysproperty key="xb.builder.useUnorderedSequence" value="true" />
     </server>
+   	
    	<!-- datagrid configs not based on SBM -->
-    <!-- <server name="datagrid-0" host="${node0}" hasWebServer="false"> -->
+   	<!-- use the HotRod server module port 11222 to check if server has started -->
+    <!-- <server name="datagrid-0" host="${node0}" hasWebServer="false" rmiPort="11222"> --> 
     <server name="datagrid-0" host="${node0}">
        <jvmarg value="-Xms128m" />
        <jvmarg value="-Xmx512m" />
@@ -1409,7 +1411,7 @@
        <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
        <sysproperty key="xb.builder.useUnorderedSequence" value="true" />
     </server>
-    <!-- <server name="datagrid-1" host="${node1}"  hasWebServer="false"> -->
+    <!-- <server name="datagrid-1" host="${node1}"  hasWebServer="false" rmiPort="11222"> -->
     <server name="datagrid-1" host="${node1}">
        <jvmarg value="-Xms128m" />
        <jvmarg value="-Xmx512m" />
@@ -1421,7 +1423,32 @@
        <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
        <sysproperty key="xb.builder.useUnorderedSequence" value="true" />
     </server>
+  
+    <server name="datagrid-startup-0" host="${node0}">
+       <jvmarg value="-Xms128m" />
+       <jvmarg value="-Xmx512m" />
+       <jvmarg value="-XX:MaxPermSize=512m" />
+       <jvmarg value="-XX:+HeapDumpOnOutOfMemoryError" />
+       <jvmarg value="-XX:-UseGCOverheadLimit" />
+       <sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
+       <sysproperty key="java.net.preferIPv4Stack" value="true" />
+       <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
+       <sysproperty key="xb.builder.useUnorderedSequence" value="true" />
+    </server>
+    <!-- <server name="datagrid-startup-1" host="${node1}"  hasWebServer="false" rmiPort="11222"> -->
+    <server name="datagrid-startup-1" host="${node1}">
+       <jvmarg value="-Xms128m" />
+       <jvmarg value="-Xmx512m" />
+       <jvmarg value="-XX:MaxPermSize=512m" />
+       <jvmarg value="-XX:+HeapDumpOnOutOfMemoryError" />
+       <jvmarg value="-XX:-UseGCOverheadLimit" />
+       <sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
+       <sysproperty key="java.net.preferIPv4Stack" value="true" />
+       <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
+       <sysproperty key="xb.builder.useUnorderedSequence" value="true" />
+    </server>
    	
+   	
    	<!-- datagrid configs based on SBM -->
    	<server name="datagrid-sbm-0" host="${node0}" httpPort="8180" rmiPort="1199">
    	   <jvmarg value="-Xms128m" />

Added: branches/JBPAPP_5_1_datagrid/testsuite/src/main/org/jboss/test/cluster/datagrid/test/DeploymentTestCase.java
===================================================================
--- branches/JBPAPP_5_1_datagrid/testsuite/src/main/org/jboss/test/cluster/datagrid/test/DeploymentTestCase.java	                        (rev 0)
+++ branches/JBPAPP_5_1_datagrid/testsuite/src/main/org/jboss/test/cluster/datagrid/test/DeploymentTestCase.java	2011-01-25 21:06:14 UTC (rev 110445)
@@ -0,0 +1,131 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009 Red Hat Middleware, Inc. and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.test.cluster.datagrid.test;
+
+import java.io.File ;
+import java.io.IOException ;
+import java.lang.InterruptedException ;
+import java.net.URL ;
+import java.net.MalformedURLException ;
+import javax.management.ObjectName ;
+import javax.management.MalformedObjectNameException ;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.jboss.test.JBossTestSetup ;
+import org.jboss.test.JBossClusteredTestCase;
+
+import org.jboss.test.scripts.support.LogFileAssertionChecker ;
+
+/**
+ * Deployment test
+ * 
+ *  Starts two EDG servers, checks for any ERROR messages in the logs, and fails the test
+ *  if error messages are present.  
+ *    
+ * @author Richard Achmatowicz
+ * @version $Revision: $
+ */
+public class DeploymentTestCase extends JBossClusteredTestCase
+{
+
+	private String jbossDist = null ;
+	private String[] errorLogPath = null ;
+	private LogFileAssertionChecker[] errorLog = null ;
+	
+	
+   /**
+    * Create a new DeploymentTestCase.
+    * 
+    * @param name
+    */
+   public DeploymentTestCase(String name)
+   {
+      super(name);           
+      
+      errorLogPath = new String[2];
+   }
+   
+   public void setUp() throws Exception 
+   {
+      super.setUp();
+      
+      jbossDist = System.getProperty("jboss.dist") ;
+      if (jbossDist == null)
+    	  throw new Exception("jboss.dist property not defined") ;
+      
+      errorLogPath[0] = jbossDist + "/server/datagrid-0/log" ;
+      errorLogPath[1] = jbossDist + "/server/datagrid-1/log" ;
+      
+      errorLog[0] = new LogFileAssertionChecker(errorLogPath[0]) ;
+      errorLog[1] = new LogFileAssertionChecker(errorLogPath[1]) ;
+   }
+
+   
+   
+   /**
+    * Tests basic access to logs 
+    */
+   public void testLogAccess() {
+
+	   if (errorLog[0].isStringInLog("Started", false, false)) {
+		   System.out.println("Started string found in error log 0") ;
+	   }
+	   else {
+		   System.out.println("Started string not found in error log 0") ;
+	   }
+	   
+	   if (errorLog[1].isStringInLog("Started", false, false)) {
+		   System.out.println("Started string found in error log 1") ;
+	   }
+	   else {
+		   System.out.println("Started string not found in error log 1") ;
+	   }
+	   
+   }
+      
+   
+   /* 
+    * one time setup mechamism
+    * only good for static stuff
+    *  
+   public static Test suite() throws Exception
+   {
+	   TestSuite suite = new TestSuite();
+	   suite.addTest(new TestSuite(TwiddleTestCase.class));
+	   
+	   JBossTestSetup setup = new JBossTestSetup(suite) {
+		   
+           protected void setUp() throws Exception {
+           }
+           
+           protected void tearDown() throws Exception {
+        	   
+           }
+	   } ;
+      return setup ;
+   }
+   */
+}



More information about the jboss-cvs-commits mailing list