EMBJOPR SVN: r856 - trunk/jsfunit.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-11-16 17:40:10 -0500 (Mon, 16 Nov 2009)
New Revision: 856
Modified:
trunk/jsfunit/pom.xml
Log:
* POM - swapped plugins order - XSLT first, then AntRun copies the result.
Modified: trunk/jsfunit/pom.xml
===================================================================
--- trunk/jsfunit/pom.xml 2009-11-16 20:51:36 UTC (rev 855)
+++ trunk/jsfunit/pom.xml 2009-11-16 22:40:10 UTC (rev 856)
@@ -850,24 +850,6 @@
<build>
<plugins>
- <!-- AntRun - move the modified web.xml - overwrite the original (MOJO-1453 workaround) . -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <!-- This has to be named this way, otherwise it would execute AFTER web.xml XSLT processing. That's Maven. -->
- <id>move-new-web.xml-overwrite-the-original-one</id> <!-- move-new-web.xml-overwrite-the-original-one -->
- <phase>package</phase>
- <configuration><tasks>
- <echo>Moving ${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/web.xml to ${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/WEB-INF/web.xml</echo>
- <move file="${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/web.xml" todir="${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/WEB-INF" />
- </tasks></configuration>
- <goals><goal>run</goal></goals>
- </execution>
- </executions>
- </plugin>
-
<!-- Change web.xml to set up MyFaces instead of RichFaces.
http://fisheye.jboss.org/browse/EMBJOPR/branches/EmbJopr_1_3_3_MyFaces/co...>
<plugin>
@@ -896,6 +878,24 @@
</executions>
</plugin>
+ <!-- AntRun - move the modified web.xml - overwrite the original (MOJO-1453 workaround) . -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <!-- This has to be named this way, otherwise it would execute AFTER web.xml XSLT processing. That's Maven. -->
+ <id>move-new-web.xml-overwrite-the-original-one</id> <!-- move-new-web.xml-overwrite-the-original-one -->
+ <phase>package</phase>
+ <configuration><tasks>
+ <echo>Moving ${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/web.xml to ${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/WEB-INF/web.xml</echo>
+ <move file="${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/web.xml" todir="${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/WEB-INF" />
+ </tasks></configuration>
+ <goals><goal>run</goal></goals>
+ </execution>
+ </executions>
+ </plugin>
+
</plugins>
</build>
</profile>
15 years, 1 month
EMBJOPR SVN: r855 - in trunk/jsfunit: src/main/resources and 3 other directories.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-11-16 15:51:36 -0500 (Mon, 16 Nov 2009)
New Revision: 855
Added:
trunk/jsfunit/src/main/resources/labels-jopr-2.4.0-SNAPSHOT.properties
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstantsLoaded.java
Modified:
trunk/jsfunit/pom.xml
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/Labels.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java
trunk/jsfunit/testdata/jboss-configuration/conf/jboss-log4j.xml
Log:
* JBQA-2774 - Modify TS to work with different versions of AS out of the box.
Now the TS checks the versions of AS/EAP, Jopr, EmbJopr etc. and loads the respective properties files incrementally.
Not sure whether I caught all the differences, let me know if not / feel free to modify the properties files after consideration.
Modified: trunk/jsfunit/pom.xml
===================================================================
--- trunk/jsfunit/pom.xml 2009-11-11 18:06:00 UTC (rev 854)
+++ trunk/jsfunit/pom.xml 2009-11-16 20:51:36 UTC (rev 855)
@@ -102,7 +102,7 @@
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<scope>compile</scope>
- <version>2.6</version>
+ <version>2.5</version>
</dependency>
<dependency>
<groupId>rhino</groupId>
@@ -125,20 +125,14 @@
<version>1.1.0.GA</version>
<scope>compile</scope>
<exclusions>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>net.sourceforge.htmlunit</groupId>
- <artifactId>htmlunit</artifactId>
- </exclusion>
+ <exclusion> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> </exclusion>
+ <exclusion> <groupId>net.sourceforge.htmlunit</groupId> <artifactId>htmlunit</artifactId> </exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.jsfunit</groupId>
<artifactId>jboss-jsfunit-richfaces</artifactId>
- <version>1.0.0.GA</version>
+ <version>1.1.0.GA</version>
<scope>compile</scope>
</dependency>
<dependency>
Added: trunk/jsfunit/src/main/resources/labels-jopr-2.4.0-SNAPSHOT.properties
===================================================================
--- trunk/jsfunit/src/main/resources/labels-jopr-2.4.0-SNAPSHOT.properties (rev 0)
+++ trunk/jsfunit/src/main/resources/labels-jopr-2.4.0-SNAPSHOT.properties 2009-11-16 20:51:36 UTC (rev 855)
@@ -0,0 +1,13 @@
+
+## JOPR 2.4.0-SNAPSHOT
+
+NAV_EJB2 = EJB 2.x Application (EJB JAR)s
+NAV_EJB3 = EJB 3.x Application (EJB JAR)s
+NAV_EAR = Enterprise Application (EAR)s
+NAV_SAR = JBoss Service (SAR)s
+NAV_MC = MC Beans
+NAV_PAR = PARs
+NAV_RAR = Resource Adaptor (RAR)s
+NAV_WAR = Web Application (WAR)s
+NAV_EMB_WAR = Embedded Web Application (WAR)s
+NAV_EMB_RAR = Embedded Resource Adaptor (RAR)s
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java 2009-11-11 18:06:00 UTC (rev 854)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java 2009-11-16 20:51:36 UTC (rev 855)
@@ -39,6 +39,7 @@
// Nav tree link label, EmbJopr display name, testdata/$dir, extension, suffix, mime type.
EAR(AppConstants.NAV_EAR, "EARs", "ear", ".ear", null, "application/ear"),
+ //EAR( AppConstantsLoaded.getLabels().get("NAV_EAR"), "EARs", "ear", ".ear", null, "application/ear"),
WAR(AppConstants.NAV_WAR, "WARs ", "war", ".war", null, "application/war"),
EJB2(AppConstants.NAV_EJB2, "EJB2 JARs", "ejb2", ".jar", null, "application/java-archive"),
EJB3(AppConstants.NAV_EJB3, "EJB3 JARs", "ejb3", ".jar", null, "application/java-archive"),
@@ -128,12 +129,14 @@
//public static final String NAV_EJB = "EJB Application (EJB JAR)s";
public static final String NAV_EJB2 = "EJB2 JARs";
public static final String NAV_EJB3 = "EJB3 JARs";
- public static final String NAV_EAR = "EARs";
+ //public static final String NAV_EAR = "EARs";
+ public static final String NAV_EAR = AppConstantsLoaded.getLabels().get("NAV_EAR");
public static final String NAV_SAR = "SARs";
public static final String NAV_MC = "MC Beans";
public static final String NAV_PAR = "PARs";
public static final String NAV_RAR = "RARs";
- public static final String NAV_WAR = "WARs";
+ //public static final String NAV_WAR = "WARs";
+ public static final String NAV_WAR = AppConstantsLoaded.getLabels().get("NAV_WAR");
public static final String NAV_EMB_WAR = "Embedded WARs";
public static final String NAV_EMB_RAR = "Embedded RARs";
Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstantsLoaded.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstantsLoaded.java (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstantsLoaded.java 2009-11-16 20:51:36 UTC (rev 855)
@@ -0,0 +1,25 @@
+
+package org.jboss.jopr.jsfunit;
+
+import org.apache.log4j.*;
+
+
+/**
+ *
+ * @author Ondrej Zizka
+ */
+public class AppConstantsLoaded {
+
+ private static Labels labels;
+ public static Labels getLabels() { return labels; }
+
+
+ static {
+ try {
+ AppConstantsLoaded.labels = Labels.createDefault();
+ } catch (Exception ex) {
+ Logger.getLogger(AppConstantsLoaded.class).error(ex);
+ }
+ }
+
+}// class
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/Labels.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/Labels.java 2009-11-11 18:06:00 UTC (rev 854)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/Labels.java 2009-11-16 20:51:36 UTC (rev 855)
@@ -21,10 +21,12 @@
Properties props; // = new Properties();
+ public String get( String name ) { return props.getProperty( name ); }
private Labels(){}
+
/**
* Returns a properties object with labels for the current environment:
* Server edition and version, Jopr version.
@@ -34,18 +36,20 @@
Labels ret = new Labels();
+
// Common
ret.props = loadProperties("labels--common.properties");
- EjtsEnvironmentInfo si = EjtsEnvironmentInfo.getInstance();
+ EjtsEnvironmentInfo envInfo = EjtsEnvironmentInfo.getInstance();
+ log.info("Environment info:\n"+envInfo.toString());
//String curJoprVersion = JBossASDiscoveryComponent.class.getPackage().getVersion();
//String curJoprVersion = System.getProperty("jopr.version");
- String curJoprVersion = si.getJoprVersion();
+ String curJoprVersion = envInfo.getJoprVersion();
// EAP / AS
- String serverEdition = si.isEAP() ? "eap" : "as";
+ String serverEdition = envInfo.isEAP() ? "eap" : "as";
String editionPropsFile = "labels-"+serverEdition+".properties";
ret.mergeProperties( loadProperties( editionPropsFile ) ) ;
@@ -54,14 +58,14 @@
// EAP / AS version.
for( String buildNumber : StringUtils.split("") ){ // TODO: Load dynamically.
- if( NumberUtils.toLong(buildNumber) > NumberUtils.toLong(si.getAsBuildNumber()) )
+ if( NumberUtils.toLong(buildNumber) > NumberUtils.toLong(envInfo.getAsBuildNumber()) )
break;
String buildPropsFile = "labels-"+serverEdition+"-"+buildNumber+".properties";
ret.mergeProperties( loadProperties( buildPropsFile ) ) ;
}
// JOPR - compare versions.
- for( String joprVersion : StringUtils.split("2.3.0.GA") ){ // TODO: Load dynamically.
+ for( String joprVersion : StringUtils.split("2.3.0.GA 2.4.0-SNAPSHOT") ){ // TODO: Load dynamically.
if( EjtsEnvironmentInfo.compareVersions(joprVersion, curJoprVersion) > 0 )
break;
String buildPropsFile = "labels-jopr-"+joprVersion+".properties";
@@ -74,6 +78,7 @@
+
/** Merge properties - rewrite old ones with the new ones. */
public void mergeProperties( Properties props ){
for( Entry e : props.entrySet() ){
@@ -85,6 +90,7 @@
/** Loads properties. */
public static Properties loadProperties(String name) throws IOException {
try {
+ log.info("Loading properties from "+name);
InputStream in = getInputStream(name);
Properties props = new Properties();
props.load(in);
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java 2009-11-11 18:06:00 UTC (rev 854)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java 2009-11-16 20:51:36 UTC (rev 855)
@@ -67,6 +67,7 @@
public boolean isEAP(){ return "EAP".equals( this.asVersionName ); }
+ /** Returns multiline environment info. */
public String toString(){
return String.format("EJTS environment info:\n AS versionName: %s\n AS versionNumber: %s\n AS buildNumber: %s" +
"\n RHQ Version: %s\n Jopr Version: %s\n EmbJopr Version: %s\n Seam Version: %s\n RichFaces Version: %s",
@@ -170,12 +171,12 @@
*/
public static int compareVersions(String aStr, String bStr){
- log.info( String.format(" ----- Comparing versions: %s and %s ... ------ ", aStr, bStr) );
+ log.debug( String.format(" ----- Comparing versions: %s and %s ... ------ ", aStr, bStr) );
final String[] aParts = StringUtils.split(aStr.toUpperCase(), ".-_");
final String[] bParts = StringUtils.split(bStr.toUpperCase(), ".-_");
- log.info( String.format(" aLen = %d, bLen = %d", aParts.length, bParts.length) );
+ //log.debug( String.format(" aLen = %d, bLen = %d", aParts.length, bParts.length) );
int aOff = 0;
int bOff = 0;
@@ -183,27 +184,35 @@
//int longer = 0;
//for( int i = v1parts.length-1; i >= 0; i--){ }
+
parts: do {
- String a = aParts[aOff];
- String b = bParts[bOff];
- log.debug( String.format("A[%d] = '%s', B[%d] = '%s'", aOff, a, bOff, b) );
-
- if( "GA".equals(a) ) a = "0";
- if( "GA".equals(b) ) b = "0";
-
- boolean aIsNum = NumberUtils.isDigits( a );
- boolean bIsNum = NumberUtils.isDigits( b );
- Integer aNum = aIsNum ? NumberUtils.createInteger( a ) : null;
- Integer bNum = bIsNum ? NumberUtils.createInteger( b ) : null;
boolean aIsLast = aOff >= aParts.length - 1;
boolean bIsLast = bOff >= bParts.length - 1;
- log.debug( String.format("A[%d] = '%s', B[%d] = '%s'", aOff, a, bOff, b) );
+ String a = aParts[aOff];
+ String b = bParts[bOff];
+ // a pseudo-loop - just to use "continue".
thisPart: do {
+ if( StringUtils.equals(a, b) )
+ continue;
+ log.debug( String.format("A[%d] = '%s', B[%d] = '%s'", aOff, a, bOff, b) );
+
+ if( "GA".equals(a) ) a = "0";
+ if( "GA".equals(b) ) b = "0";
+
+ boolean aIsNum = NumberUtils.isDigits( a );
+ boolean bIsNum = NumberUtils.isDigits( b );
+ Integer aNum = aIsNum ? NumberUtils.createInteger( a ) : null;
+ Integer bNum = bIsNum ? NumberUtils.createInteger( b ) : null;
+
+ log.debug( String.format("A[%d] = '%s', B[%d] = '%s'", aOff, a, bOff, b) );
+
+
+
if( aIsNum && bIsNum ){
log.debug("aIsNum && bIsNum");
int diff = aNum - bNum;
Modified: trunk/jsfunit/testdata/jboss-configuration/conf/jboss-log4j.xml
===================================================================
--- trunk/jsfunit/testdata/jboss-configuration/conf/jboss-log4j.xml 2009-11-11 18:06:00 UTC (rev 854)
+++ trunk/jsfunit/testdata/jboss-configuration/conf/jboss-log4j.xml 2009-11-16 20:51:36 UTC (rev 855)
@@ -241,7 +241,12 @@
<priority value="DEBUG"/>
</category>
+ <!-- Mute compareVersions()'s debug output. -->
+ <category name="org.jboss.jopr.jsfunit.util.EjtsEnvironmentInfo">
+ <priority value="INFO"/>
+ </category>
+
15 years, 1 month
EMBJOPR SVN: r854 - in trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit: util and 1 other directory.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-11-11 13:06:00 -0500 (Wed, 11 Nov 2009)
New Revision: 854
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EjtsSelfTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java
Log:
* Version comparison finished.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EjtsSelfTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EjtsSelfTest.java 2009-11-11 17:05:38 UTC (rev 853)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EjtsSelfTest.java 2009-11-11 18:06:00 UTC (rev 854)
@@ -22,12 +22,15 @@
*/
public class EjtsSelfTest extends ServletTestCase {
+ public static void main( String[] args ){
+ new EjtsSelfTest().testVersionComparison();
+ }
+
private static final Logger log = Logger.getLogger( EjtsSelfTest.class.getName() );
/** */
- public void testEnvironmentInfo() throws EmbJoprTestException, Exception {
+ public void XtestEnvironmentInfo() throws EmbJoprTestException, Exception {
-
EjtsEnvironmentInfo eei = EjtsEnvironmentInfo.createFromLocalServer();
log.info( eei.toString() );
@@ -42,8 +45,12 @@
log.info("Manifest loaded: ");
logManifest( new Manifest( is ) );
+ }
+
+
+
+ public void testVersionComparison(){
-
boolean succ = true;
succ &= doCompareVersions("2.3.0.GA", "2.4.0-SNAPSHOT", -1);
succ &= doCompareVersions("2.4.0.GA", "2.4.0-SNAPSHOT", 1);
@@ -61,7 +68,7 @@
private boolean doCompareVersions( String v1, String v2, int expectedSignum ){
int compared = EjtsEnvironmentInfo.compareVersions(v1, v2);
- log.info( String.format("Comparing versions: %s and %s produces: %d, expected: %d", v1, v2, compared, expectedSignum ) );
+ log.info( String.format("Comparing versions: %s and %s produces: %d, expected: %d\n", v1, v2, compared, expectedSignum ) );
return Integer.signum(expectedSignum) == Integer.signum( compared );
}
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java 2009-11-11 17:05:38 UTC (rev 853)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java 2009-11-11 18:06:00 UTC (rev 854)
@@ -24,7 +24,6 @@
import java.util.jar.Manifest;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
-import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import org.jboss.jopr.jsfunit.JMXUtils;
import org.jboss.logging.Logger;
@@ -171,17 +170,20 @@
*/
public static int compareVersions(String aStr, String bStr){
- //*
+ log.info( String.format(" ----- Comparing versions: %s and %s ... ------ ", aStr, bStr) );
+
final String[] aParts = StringUtils.split(aStr.toUpperCase(), ".-_");
final String[] bParts = StringUtils.split(bStr.toUpperCase(), ".-_");
+ log.info( String.format(" aLen = %d, bLen = %d", aParts.length, bParts.length) );
+
int aOff = 0;
int bOff = 0;
//int longer = 0;
//for( int i = v1parts.length-1; i >= 0; i--){ }
- do {
+ parts: do {
String a = aParts[aOff];
String b = bParts[bOff];
@@ -197,20 +199,18 @@
boolean aIsLast = aOff >= aParts.length - 1;
boolean bIsLast = bOff >= bParts.length - 1;
-
log.debug( String.format("A[%d] = '%s', B[%d] = '%s'", aOff, a, bOff, b) );
- evaluation: {
+ thisPart: do {
+
if( aIsNum && bIsNum ){
log.debug("aIsNum && bIsNum");
int diff = aNum - bNum;
// Different numbers - return the diff.
if( diff != 0 ) return diff;
// The same numbers - skip to next position.
- if( !aIsLast ) aOff++;
- if( !bIsLast ) bOff++;
- continue;
+ break thisPart;
}
else if( aIsNum ^ bIsNum ){
@@ -218,21 +218,18 @@
if( aIsNum ){
// Skip aditional "decimal" zeros - e.g. 2.0.0.FOO vs. 2.0.BAR .
if ( aNum == 0 ){
- if( ! aIsLast ){ aOff++; continue; }
+ if( ! aIsLast ){ aOff++; continue parts; }
return compareStrings("0", b); // or: +getStringLevel(a);
}
- // 2.0.0.1 vs. 2.0.0.SNAPSHOT
return 1;
}
else /* vice versa for ( bIsNum ) */ {
// Skip aditional "decimal" zeros - e.g. 2.0.0.FOO vs. 2.0.BAR .
if ( bNum == 0 ){
- if( ! bIsLast ){ bOff++; continue; }
+ if( ! bIsLast ){ bOff++; continue parts; }
return compareStrings(a, "0"); // or: -getStringLevel(b);
}
- // 2.0.0.1 vs. 2.0.0.SNAPSHOT
- // 2.0.0.1 vs. 2.0.0.SP2
return -1;
}
}
@@ -252,15 +249,21 @@
return strDiff;
}
- }// label evaluation:
+ } while( false ); // label thisPart:
// Advance to the next part, unless we're at the last one..
- if( aOff < aParts.length -1 ) aOff++;
- if( bOff < bParts.length -1 ) bOff++;
+ //if( aOff < aParts.length -1 ) aOff++;
+ //if( bOff < bParts.length -1 ) bOff++;
+ log.debug( String.format("Incrementing... %s %s", aIsLast, bIsLast) );
+ if( ! aIsLast ) aOff++;
+ if( ! bIsLast ) bOff++;
+ if( aIsLast && bIsLast ) break;
+
// End when we reached the last parts of both versions.
- } while( aOff < aParts.length || bOff < bParts.length );
+ } while ( true );
+ //} while( aOff < aParts.length -1 || bOff < bParts.length -1 );
log.debug("Reached comparison loop end.");
@@ -273,7 +276,39 @@
return v1.compareTo(v2);
/**/
+ }// compareVersions();
+
+
+
+
+
+
+ public static void main( String[] arge ){
+
+ boolean succ = true;
+ succ &= doCompareVersions("2.3.0.GA", "2.4.0-SNAPSHOT", -1);
+ succ &= doCompareVersions("2.4.0.GA", "2.4.0-SNAPSHOT", 1);
+ succ &= doCompareVersions("2.4.1.GA", "2.4.0-SNAPSHOT", 1);
+ succ &= doCompareVersions("2.4.1", "2.4.0-SNAPSHOT", 1);
+ succ &= doCompareVersions("2.4.0", "2.4.0-SNAPSHOT", 1);
+ succ &= doCompareVersions("2.4.0", "2.4.0.GA", 0);
+ succ &= doCompareVersions("2.4.0.CR1", "2.4.0.GA", -1);
+ succ &= doCompareVersions("2.4.CR1", "2.4.0.GA", -1);
+ succ &= doCompareVersions("2.4.CR1", "2.4.0", -1);
+ succ &= doCompareVersions("2.0.0.0", "2.0.0.SNAPSHOT", 1);
+ succ &= doCompareVersions("2.0.0.1", "2.0.0.SNAPSHOT", -1);
+ succ &= doCompareVersions("2.0.0.1", "2.0.0.SP2", 1);
+ succ &= doCompareVersions("2.0.0.1", "2.0.SP2", 1);
+
}
+
+ private static boolean doCompareVersions( String v1, String v2, int expectedSignum ){
+ int compared = EjtsEnvironmentInfo.compareVersions(v1, v2);
+ log.info( String.format("Comparing versions: %s and %s produces: %d, expected: %d\n", v1, v2, compared, expectedSignum ) );
+ return Integer.signum(expectedSignum) == Integer.signum( compared );
+ }
+
+
}// class
15 years, 1 month
EMBJOPR SVN: r853 - branches/EmbJopr_1_3_3_MyFaces/jsfunit/src/test/java/org/jboss/jopr/jsfunit.
by embjopr-commits@lists.jboss.org
Author: smcgowan(a)redhat.com
Date: 2009-11-11 12:05:38 -0500 (Wed, 11 Nov 2009)
New Revision: 853
Modified:
branches/EmbJopr_1_3_3_MyFaces/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbJoprTestConstants.java
Log:
JBoss AS name change from 5.2.0.Beta1 to 6.0.0.M1
Modified: branches/EmbJopr_1_3_3_MyFaces/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbJoprTestConstants.java
===================================================================
--- branches/EmbJopr_1_3_3_MyFaces/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbJoprTestConstants.java 2009-11-11 16:26:05 UTC (rev 852)
+++ branches/EmbJopr_1_3_3_MyFaces/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbJoprTestConstants.java 2009-11-11 17:05:38 UTC (rev 853)
@@ -20,7 +20,8 @@
public static String SYSPROP_CARGO_JBOSS_HOME_DIR = "jsfunit.jboss.home.dir";
- public static final String AS_NODE_NAME_FORMAT = "JBoss AS 5 (%s)";
+ // AS Name Change to 6.0.0.M1
+ public static final String AS_NODE_NAME_FORMAT = "JBoss AS 6 (%s)";
//public static final String AS_NODE_NAME_FORMAT = "JBoss EAP 5 (%s)";
public static final String AS_NODE_DESCRIPTION = "JBoss Application Server";
//public static final String AS_NODE_DESCRIPTION = "JBoss Enterprise Application Platform (EAP)";
15 years, 1 month
EMBJOPR SVN: r852 - in trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit: util and 1 other directory.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-11-11 11:26:05 -0500 (Wed, 11 Nov 2009)
New Revision: 852
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EjtsSelfTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java
Log:
* Version comparison
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EjtsSelfTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EjtsSelfTest.java 2009-11-10 17:39:49 UTC (rev 851)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EjtsSelfTest.java 2009-11-11 16:26:05 UTC (rev 852)
@@ -44,20 +44,25 @@
logManifest( new Manifest( is ) );
- doCompareVersions("2.3.0.GA", "2.4.0-SNAPSHOT", -1);
- doCompareVersions("2.4.0.GA", "2.4.0-SNAPSHOT", 1);
- doCompareVersions("2.4.1.GA", "2.4.0-SNAPSHOT", 1);
- doCompareVersions("2.4.1", "2.4.0-SNAPSHOT", 1);
- doCompareVersions("2.4.0", "2.4.0-SNAPSHOT", 1);
- doCompareVersions("2.4.0", "2.4.0.GA", 0);
- doCompareVersions("2.4.0.CR1", "2.4.0.GA", -1);
- doCompareVersions("2.4.CR1", "2.4.0.GA", -1);
- doCompareVersions("2.4.CR1", "2.4.0", -1);
+ boolean succ = true;
+ succ &= doCompareVersions("2.3.0.GA", "2.4.0-SNAPSHOT", -1);
+ succ &= doCompareVersions("2.4.0.GA", "2.4.0-SNAPSHOT", 1);
+ succ &= doCompareVersions("2.4.1.GA", "2.4.0-SNAPSHOT", 1);
+ succ &= doCompareVersions("2.4.1", "2.4.0-SNAPSHOT", 1);
+ succ &= doCompareVersions("2.4.0", "2.4.0-SNAPSHOT", 1);
+ succ &= doCompareVersions("2.4.0", "2.4.0.GA", 0);
+ succ &= doCompareVersions("2.4.0.CR1", "2.4.0.GA", -1);
+ succ &= doCompareVersions("2.4.CR1", "2.4.0.GA", -1);
+ succ &= doCompareVersions("2.4.CR1", "2.4.0", -1);
+ if( ! succ )
+ fail("Version comparisons do not fit.");
}
- private void doCompareVersions( String v1, String v2, int expectedSignum ){
- log.info( String.format("Comparing versions: %s and %s produces: %d", v1, v2, EjtsEnvironmentInfo.compareVersions(v1, v2) ) );
+ private boolean doCompareVersions( String v1, String v2, int expectedSignum ){
+ int compared = EjtsEnvironmentInfo.compareVersions(v1, v2);
+ log.info( String.format("Comparing versions: %s and %s produces: %d, expected: %d", v1, v2, compared, expectedSignum ) );
+ return Integer.signum(expectedSignum) == Integer.signum( compared );
}
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java 2009-11-10 17:39:49 UTC (rev 851)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java 2009-11-11 16:26:05 UTC (rev 852)
@@ -26,6 +26,7 @@
import org.apache.commons.lang.math.NumberUtils;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import org.jboss.jopr.jsfunit.JMXUtils;
+import org.jboss.logging.Logger;
/**
*
@@ -33,6 +34,8 @@
*/
public class EjtsEnvironmentInfo
{
+ private static final Logger log = Logger.getLogger( EjtsEnvironmentInfo.class.getName() );
+
private static EjtsEnvironmentInfo INSTANCE;
public static EjtsEnvironmentInfo getInstance() throws Exception {
@@ -123,19 +126,56 @@
return envInfo;
}
+ /**
+ * Strings after release: SP, CP
+ * Strings for release: GA, GOLD, 0
+ * Latest before release: SNAPSHOT
+ * Before release: (any other)
+ * @param s
+ * @return
+ */
+ private static final int getStringLevel( String s ){
+ if( "SP".equalsIgnoreCase(s) || "CP".equalsIgnoreCase(s) )
+ return 1;
+ if( "GA".equalsIgnoreCase(s) || "GOLD".equalsIgnoreCase(s) || "0".equalsIgnoreCase(s) )
+ return 0;
+ if( "SNAPSHOT".equalsIgnoreCase(s) )
+ return -1;
+ return -2;
+ }
/**
+ * Compares two string parts of the version string, e.g. "GA" vs. "SNAPSHOT".
+ * @returns like compareTo() does.
+ */
+ public static int compareStrings( String a, String b ){
+ int aLev = getStringLevel( a );
+ int bLev = getStringLevel( b );
+
+ if( aLev == bLev )
+ return a.compareToIgnoreCase(b);
+ else
+ return aLev - bLev;
+ }
+
+
+ /**
* Compares two version strings, like compareTo() does.
* TODO: Maven comparison algorithm works bad; Code own one.
+ *
+ * Strings after release: SP, CP
+ * Strings for release: GA, GOLD
+ * Latest before release: SNAPSHOT
+ * Before release: (any other)
*/
public static int compareVersions(String aStr, String bStr){
//*
- String[] aParts = StringUtils.split(aStr.toUpperCase(), ".-_");
- String[] bParts = StringUtils.split(bStr.toUpperCase(), ".-_");
+ final String[] aParts = StringUtils.split(aStr.toUpperCase(), ".-_");
+ final String[] bParts = StringUtils.split(bStr.toUpperCase(), ".-_");
- int aOff= 0;
+ int aOff = 0;
int bOff = 0;
//int longer = 0;
@@ -144,6 +184,8 @@
do {
String a = aParts[aOff];
String b = bParts[bOff];
+
+ log.debug( String.format("A[%d] = '%s', B[%d] = '%s'", aOff, a, bOff, b) );
if( "GA".equals(a) ) a = "0";
if( "GA".equals(b) ) b = "0";
@@ -152,38 +194,78 @@
boolean bIsNum = NumberUtils.isDigits( b );
Integer aNum = aIsNum ? NumberUtils.createInteger( a ) : null;
Integer bNum = bIsNum ? NumberUtils.createInteger( b ) : null;
+ boolean aIsLast = aOff >= aParts.length - 1;
+ boolean bIsLast = bOff >= bParts.length - 1;
- if( aIsNum && bIsNum ){
- int diff = aNum - bNum;
- // Different numbers - return the diff.
- if( diff != 0 ) return diff;
- // The same numbers - skip to next position.
- aOff++; bOff++; continue;
- }
- else if( aIsNum ^ bIsNum ){
+ log.debug( String.format("A[%d] = '%s', B[%d] = '%s'", aOff, a, bOff, b) );
- if( aIsNum ){
- // Skip aditional "decimal" zeros - e.g. 2.0.0.FOO vs. 2.0.BAR .
- if ( aNum == 0 ){ aOff++; continue; }
- // A non-zero number is always bigger than any string (except GA).
- else { return 1; }
+ evaluation: {
+
+ if( aIsNum && bIsNum ){
+ log.debug("aIsNum && bIsNum");
+ int diff = aNum - bNum;
+ // Different numbers - return the diff.
+ if( diff != 0 ) return diff;
+ // The same numbers - skip to next position.
+ if( !aIsLast ) aOff++;
+ if( !bIsLast ) bOff++;
+ continue;
}
- else /* vice versa for ( bIsNum ) */ {
- // Skip aditional "decimal" zeros - e.g. 2.0.0.FOO vs. 2.0.BAR .
- if ( bNum == 0 ){ bOff++; continue; }
- // A non-zero number is always bigger than any string (except GA).
- else { return -1; }
+ else if( aIsNum ^ bIsNum ){
+ log.debug("aIsNum ^ bIsNum");
+ if( aIsNum ){
+ // Skip aditional "decimal" zeros - e.g. 2.0.0.FOO vs. 2.0.BAR .
+ if ( aNum == 0 ){
+ if( ! aIsLast ){ aOff++; continue; }
+ return compareStrings("0", b); // or: +getStringLevel(a);
+ }
+ // 2.0.0.1 vs. 2.0.0.SNAPSHOT
+ return 1;
+
+ }
+ else /* vice versa for ( bIsNum ) */ {
+ // Skip aditional "decimal" zeros - e.g. 2.0.0.FOO vs. 2.0.BAR .
+ if ( bNum == 0 ){
+ if( ! bIsLast ){ bOff++; continue; }
+ return compareStrings(a, "0"); // or: -getStringLevel(b);
+ }
+ // 2.0.0.1 vs. 2.0.0.SNAPSHOT
+ // 2.0.0.1 vs. 2.0.0.SP2
+ return -1;
+ }
}
- }
- // Neither is a number -> Compare two strings.
- return a.compareTo(b);
+ // Neither is a number -> Compare two strings.
+ {
+ // CP - cumulative patch - is bigger than other strings. SP should be far enough in the alphabet.
+ // (There is a need for standardized project versioning strings.)
+
+ //if( "CP".equals(a) ) a = "SP";
+ //if( "CP".equals(b) ) b = "SP";
+
+ log.debug("Comparing strings produces" + compareStrings(a, b) );
+ int strDiff = compareStrings(a, b);
+ if( strDiff != 0 )
+ return strDiff;
+ }
+
+ }// label evaluation:
+
- } while( aOff < aParts.length && bOff < bParts.length );
+ // Advance to the next part, unless we're at the last one..
+ if( aOff < aParts.length -1 ) aOff++;
+ if( bOff < bParts.length -1 ) bOff++;
+ // End when we reached the last parts of both versions.
+ } while( aOff < aParts.length || bOff < bParts.length );
+
+ log.debug("Reached comparison loop end.");
+
+ return 0; // TODO: Fix
+
/*
// Maven's algorithm.
DefaultArtifactVersion v1 = new DefaultArtifactVersion(v1s);
@@ -191,18 +273,7 @@
return v1.compareTo(v2);
/**/
- return 0;
}
- class VersionInfo{
-
- public VersionInfo( String str ){
-
-
- }
-
- }
-
-
}// class
15 years, 1 month
EMBJOPR SVN: r851 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-11-10 12:39:49 -0500 (Tue, 10 Nov 2009)
New Revision: 851
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java
Log:
* Typo fixed
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java 2009-11-10 17:38:40 UTC (rev 850)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java 2009-11-10 17:39:49 UTC (rev 851)
@@ -190,6 +190,8 @@
DefaultArtifactVersion v2 = new DefaultArtifactVersion(v2s);
return v1.compareTo(v2);
/**/
+
+ return 0;
}
class VersionInfo{
15 years, 1 month
EMBJOPR SVN: r850 - in trunk/jsfunit: src/main/resources and 2 other directories.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-11-10 12:38:40 -0500 (Tue, 10 Nov 2009)
New Revision: 850
Modified:
trunk/jsfunit/pom.xml
trunk/jsfunit/src/main/resources/labels--common.properties
trunk/jsfunit/src/main/resources/labels-jopr-2.3.0.GA.properties
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EjtsSelfTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/Labels.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java
Log:
* JBQA-2770, JBQA-2774:
* Modified the labels-* files which keep the strings for different versions.
* Added Labels class which keeps the strings, depending on versions.
* Added EjtsEnvironmentInfo which probes and stores what versions we are running with (currently reads from the manifest, where the info is put by Maven).
* EjtsSelfTest is a debugging class, will be removed.
* POM: Added "pause" profile which keeps the server on for 4 minutes.
* POM: Added manifest modification - puts deps versions in there.
Modified: trunk/jsfunit/pom.xml
===================================================================
--- trunk/jsfunit/pom.xml 2009-11-07 07:24:09 UTC (rev 849)
+++ trunk/jsfunit/pom.xml 2009-11-10 17:38:40 UTC (rev 850)
@@ -90,7 +90,7 @@
<!-- Test cases deps. -->
<dependency>
<groupId>org.jboss.qa.jbcache</groupId>
- <artifactId>jboss-cache-testop-client</artifactId>
+ <artifactId>jboss-cache-test-client</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/testdata/jbcache/JBossCacheTest-by-fdrabek-client.jar</systemPath>
@@ -102,7 +102,7 @@
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<scope>compile</scope>
- <version>2.5</version>
+ <version>2.6</version>
</dependency>
<dependency>
<groupId>rhino</groupId>
@@ -144,19 +144,19 @@
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
- <version>1.2</version>
+ <version>1.2</version> <!-- 2.0 -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-j2se</artifactId>
- <version>5.0.1.GA</version>
+ <version>5.0.1.GA</version> <!-- 5.1.0.GA -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>2.4</version>
+ <version>2.4</version> <!-- 2.5 -->
<scope>provided</scope>
</dependency>
<dependency>
@@ -169,12 +169,12 @@
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<scope>provided</scope>
- <version>2.8.1</version>
+ <version>2.8.1</version> <!-- 2.9.1 -->
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
- <version>1.0</version>
+ <version>1.0</version> <!-- 1.1 -->
</dependency>
<dependency>
<groupId>commons-lang</groupId>
@@ -184,13 +184,13 @@
<dependency>
<groupId>org.jboss.integration</groupId>
<artifactId>jboss-profileservice-spi</artifactId>
- <version>5.1.0.GA</version>
+ <version>5.1.0.GA</version> <!-- 5.1.0.SP1 -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.man</groupId>
<artifactId>jboss-metatype</artifactId>
- <version>2.1.0.SP1</version>
+ <version>2.1.0.SP1</version> <!-- 2.1.1.GA -->
<scope>provided</scope>
</dependency>
<dependency>
@@ -208,7 +208,7 @@
<dependency>
<groupId>org.jboss.javaee</groupId>
<artifactId>jboss-javaee</artifactId>
- <version>5.0.1.GA</version>
+ <version>5.0.1.GA</version> <!-- 5.2.0.Beta1 -->
<scope>provided</scope>
</dependency>
</dependencies>
@@ -393,10 +393,10 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
+ <!-- Extract WAR - SEAM bug. -->
<execution>
<id>extract_war_for_cargo</id>
- <phase>package</phase>
- <goals><goal>run</goal></goals>
+ <phase>package</phase> <goals><goal>run</goal></goals>
<configuration><tasks>
<echo>Exctracting war...</echo>
<move file="${project.build.directory}/${project.build.finalName}.${project.packaging}"
@@ -405,6 +405,7 @@
dest="${project.build.directory}/${project.build.finalName}.${project.packaging}"/>
</tasks></configuration>
</execution>
+ <!-- Write "Don't kill" to hudson log/ -->
<execution>
<id>dont_kill_appeal</id>
<phase>pre-integration-test</phase> <goals><goal>run</goal></goals>
@@ -413,6 +414,17 @@
<echo>########################## There's no logging visible on Hudson during test run.</echo>
</tasks></configuration>
</execution>
+ <!-- Delete the exploded WAR and rename the archive back. -->
+ <execution>
+ <id>rename-the-artifact-back</id>
+ <phase>post-integration-test</phase> <goals><goal>run</goal></goals>
+ <configuration><tasks>
+ <echo>Renaming exploded war and renaming the zip back to the artifact name.</echo>
+ <move file="${project.build.directory}/${project.build.finalName}.${project.packaging}" toFile="${project.build.directory}/${project.build.finalName}_exploded.${project.packaging}"/>
+ <move file="${project.build.directory}/${project.build.finalName}_archive.${project.packaging}"
+ toFile="${project.build.directory}/${project.build.finalName}.${project.packaging}"/>
+ </tasks></configuration>
+ </execution>
</executions>
</plugin>
@@ -843,7 +855,26 @@
<build>
<plugins>
- <!-- TODO: Change web.xml to set up MyFaces instead of RichFaces.
+
+ <!-- AntRun - move the modified web.xml - overwrite the original (MOJO-1453 workaround) . -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <!-- This has to be named this way, otherwise it would execute AFTER web.xml XSLT processing. That's Maven. -->
+ <id>move-new-web.xml-overwrite-the-original-one</id> <!-- move-new-web.xml-overwrite-the-original-one -->
+ <phase>package</phase>
+ <configuration><tasks>
+ <echo>Moving ${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/web.xml to ${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/WEB-INF/web.xml</echo>
+ <move file="${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/web.xml" todir="${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/WEB-INF" />
+ </tasks></configuration>
+ <goals><goal>run</goal></goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Change web.xml to set up MyFaces instead of RichFaces.
http://fisheye.jboss.org/browse/EMBJOPR/branches/EmbJopr_1_3_3_MyFaces/co...>
<plugin>
<groupId>org.codehaus.mojo</groupId>
@@ -871,24 +902,33 @@
</executions>
</plugin>
- <!-- AntRun - move the modified web.xml - overwrite the original (MOJO-1453 workaround) . -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <!-- This has to be named this way, otherwise it would execute AFTER web.xml XSLT processing. That's Maven. -->
- <id>delete_bundled_admin_console_war</id> <!-- move-new-web.xml-overwrite-the-original-one -->
- <phase>package</phase>
- <configuration><tasks>
- <echo>Moving ${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/web.xml to ${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/WEB-INF/web.xml</echo>
- <move file="${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/web.xml" todir="${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/WEB-INF" />
- </tasks></configuration>
- <goals><goal>run</goal></goals>
- </execution>
- </executions>
- </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!-- Sleep after build, before killing JBoss AS. -->
+ <profile>
+ <id>pause</id>
+ <build>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <!-- Pause - debug purposes - to be able to inspect JBoss AS instance made by Cargo. -->
+ <execution>
+ <id>pause-after-tests</id>
+ <phase>integration-test</phase> <goals><goal>run</goal></goals>
+ <configuration><tasks>
+ <echo>Sleep for a minute...</echo>
+ <sleep seconds="240"/>
+ </tasks></configuration>
+ </execution>
+ </executions>
+ </plugin>
+
</plugins>
</build>
</profile>
@@ -896,7 +936,6 @@
-
<!-- Hudson profile (commented out - hesitating to hard-code version dir to pom.xml)
<profile>
<id>running-in-hudson</id>
@@ -932,18 +971,27 @@
<resource>
<directory>${basedir}/src/build/resources</directory>
<excludes><exclude>**/*</exclude></excludes>
+ <filtering>true</filtering>
</resource>
</resources>
<plugins>
- <!-- WAR -->
+ <!-- WAR: Add data to manifest, add JBoss Cache client JAR. -->
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<useCache>false</useCache>
<archive>
+ <manifestEntries>
+ <Test-Test>testvalue</Test-Test>
+ <rhq-version>${rhq.version}</rhq-version>
+ <jopr-version>${jopr.version}</jopr-version>
+ <embjopr-version>${project.version}</embjopr-version>
+ <seam-version>${seam.version}</seam-version>
+ <richfaces-version>${richfaces.version}</richfaces-version>
+ </manifestEntries>
<manifest>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
Modified: trunk/jsfunit/src/main/resources/labels--common.properties
===================================================================
--- trunk/jsfunit/src/main/resources/labels--common.properties 2009-11-07 07:24:09 UTC (rev 849)
+++ trunk/jsfunit/src/main/resources/labels--common.properties 2009-11-10 17:38:40 UTC (rev 850)
@@ -53,20 +53,21 @@
### Navigation. ###
-
NAV_APPLICATIONS = Applications
##NAV_EJB = EJB Application (EJB JAR)s
-NAV_EJB2 = EJB2 JARs
-NAV_EJB3 = EJB3 JARs
-NAV_EAR = EARs
-NAV_SAR = SARs
+NAV_EJB2 = EJB 2.x Application (EJB JAR)s
+NAV_EJB3 = EJB 3.x Application (EJB JAR)s
+NAV_EAR = Enterprise Application (EAR)s
+NAV_SAR = JBoss Service (SAR)s
NAV_MC = MC Beans
NAV_PAR = PARs
-NAV_RAR = RARs
-NAV_WAR = WARs
-NAV_EMB_WAR = Embedded WARs
-NAV_EMB_RAR = Embedded RARs
+NAV_RAR = Resource Adaptor (RAR)s
+NAV_WAR = Web Application (WAR)s
+NAV_EMB_WAR = Embedded Web Application (WAR)s
+NAV_EMB_RAR = Embedded Resource Adaptor (RAR)s
+#NAV_EMB_JAR = EJB 2.x Application (EJB JAR)
+
## Non-app resource types.
NAV_SBM = Service Binding Manager
NAV_SBM_SETS = Service Binding Sets
Modified: trunk/jsfunit/src/main/resources/labels-jopr-2.3.0.GA.properties
===================================================================
--- trunk/jsfunit/src/main/resources/labels-jopr-2.3.0.GA.properties 2009-11-07 07:24:09 UTC (rev 849)
+++ trunk/jsfunit/src/main/resources/labels-jopr-2.3.0.GA.properties 2009-11-10 17:38:40 UTC (rev 850)
@@ -2,3 +2,40 @@
JBCACHE_MVCC_ENTITY = "mvcc-entity"
JBCACHE_PESSIMISTIC_SHARED = "pessimistic-shared"
JBCACHE_TIMESTAMPS = "timestamps-cache"
+
+
+
+# http://fisheye.jboss.org/browse/JOPR/tags/Jopr_2_3_0_EmbJopr_1_2_0-1/modu...
+#r640 - shorten names for deployment ResourceTypes
+# tag Jopr_2_3_0_EmbJopr_1_2_0-1
+
+NAV_EJB2 = EJB2 JARs
+NAV_EJB3 = EJB3 JARs
+NAV_EAR = EARs
+NAV_SAR = SARs
+NAV_MC = MC Beans
+NAV_PAR = PARs
+NAV_RAR = RARs
+NAV_WAR = WARs
+NAV_EMB_WAR = Embedded WARs
+NAV_EMB_RAR = Embedded RARs
+
+
+# http://fisheye.jboss.org/browse/JOPR/trunk/modules/plugins/jboss-as-5/src...
+# r473 -
+#NAV_EMB_EJB2 = Embedded EJB 2.x Application (EJB JAR)
+#NAV_EMB_EJB3 = Embedded EJB 3.x Application (EJB JAR)
+#NAV_EMB_RAR = Embedded Resource Adaptor (RAR)
+
+# r587 - add new "Web Application Context" ResourceType as child of "Web Application (WAR)" ResourceType
+
+# r593 - added JBoss Web, Connector, and Virtual Host Resource types; did some misc cleanup & refactoring of the descriptor and the code
+
+# r598 - "resource adaptor" -> "resource adapter"
+
+# r626 - Script service added.
+
+# r737 - JOPR-172 JVM of the JBossAs added.
+
+# r1042 - rename EAR and WAR ResourceTypes so they have the same names as the EAR and WAR ResourceTypes in the AS4 plugin (https://jira.jboss.org/jira/browse/JOPR-320)
+# tag Jopr_2_3_0
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EjtsSelfTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EjtsSelfTest.java 2009-11-07 07:24:09 UTC (rev 849)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EjtsSelfTest.java 2009-11-10 17:38:40 UTC (rev 850)
@@ -1,6 +1,16 @@
package org.jboss.jopr.jsfunit;
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.Map.Entry;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+import java.util.logging.Level;
import org.apache.cactus.ServletTestCase;
import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
import org.jboss.jopr.jsfunit.util.EjtsEnvironmentInfo;
@@ -16,9 +26,24 @@
/** */
public void testEnvironmentInfo() throws EmbJoprTestException, Exception {
+
+
EjtsEnvironmentInfo eei = EjtsEnvironmentInfo.createFromLocalServer();
log.info( eei.toString() );
+
+ log.info("Classloader: "+ EjtsEnvironmentInfo.class.getClassLoader().getClass() );
+ log.info("Classloader: "+ EjtsEnvironmentInfo.class.getClassLoader().toString() );
+
+ log.info("Manifest content: ");
+ InputStream is = EjtsEnvironmentInfo.class.getResourceAsStream("/META-INF/MANIFEST.MF");
+ logInputStream(is);
+
+
+ log.info("Manifest loaded: ");
+ logManifest( new Manifest( is ) );
+
+
doCompareVersions("2.3.0.GA", "2.4.0-SNAPSHOT", -1);
doCompareVersions("2.4.0.GA", "2.4.0-SNAPSHOT", 1);
doCompareVersions("2.4.1.GA", "2.4.0-SNAPSHOT", 1);
@@ -30,7 +55,8 @@
doCompareVersions("2.4.CR1", "2.4.0", -1);
}
- private void doCompareVersions( String v1, String v2, int expectedSignum ){
+
+ private void doCompareVersions( String v1, String v2, int expectedSignum ){
log.info( String.format("Comparing versions: %s and %s produces: %d", v1, v2, EjtsEnvironmentInfo.compareVersions(v1, v2) ) );
}
@@ -43,6 +69,33 @@
}
+
+
+
+ private void logManifest( Manifest mf ){
+ Attributes attrs = mf.getMainAttributes();
+ log.info("Manifest attributes: ");
+ for( Entry e : attrs.entrySet() ){
+ log.info( String.format(" %s : %s", e.getKey(), e.getValue() ) );
+ }
+ }
+
+ private void logInputStream( InputStream is ) {
+ try {
+ BufferedReader br = new BufferedReader(new InputStreamReader(is));
+ String line;
+ while (br.ready()) {
+ log.info(" " + br.readLine());
+ }
+ } catch (IOException ex) {
+ log.warn( ex );
+ }
+ finally {
+ try{ is.close(); } catch( Throwable t ){ }
+ }
+ }
+
+
}// class
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/Labels.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/Labels.java 2009-11-07 07:24:09 UTC (rev 849)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/Labels.java 2009-11-10 17:38:40 UTC (rev 850)
@@ -7,7 +7,6 @@
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
-import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import org.jboss.jopr.jsfunit.util.EjtsEnvironmentInfo;
import org.jboss.logging.Logger;
@@ -39,8 +38,9 @@
ret.props = loadProperties("labels--common.properties");
EjtsEnvironmentInfo si = EjtsEnvironmentInfo.getInstance();
- //String joprVersion = JBossASDiscoveryComponent.class.getPackage().getVersion();
- String curJoprVersion = System.getProperty("jopr.version");
+ //String curJoprVersion = JBossASDiscoveryComponent.class.getPackage().getVersion();
+ //String curJoprVersion = System.getProperty("jopr.version");
+ String curJoprVersion = si.getJoprVersion();
@@ -54,13 +54,13 @@
// EAP / AS version.
for( String buildNumber : StringUtils.split("") ){ // TODO: Load dynamically.
- if( NumberUtils.toLong(buildNumber) > NumberUtils.toLong(si.getBuildNumber()) )
+ if( NumberUtils.toLong(buildNumber) > NumberUtils.toLong(si.getAsBuildNumber()) )
break;
String buildPropsFile = "labels-"+serverEdition+"-"+buildNumber+".properties";
ret.mergeProperties( loadProperties( buildPropsFile ) ) ;
}
- // JOPR
+ // JOPR - compare versions.
for( String joprVersion : StringUtils.split("2.3.0.GA") ){ // TODO: Load dynamically.
if( EjtsEnvironmentInfo.compareVersions(joprVersion, curJoprVersion) > 0 )
break;
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java 2009-11-07 07:24:09 UTC (rev 849)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java 2009-11-10 17:38:40 UTC (rev 850)
@@ -19,6 +19,11 @@
package org.jboss.jopr.jsfunit.util;
+import java.net.URL;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.math.NumberUtils;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import org.jboss.jopr.jsfunit.JMXUtils;
@@ -37,21 +42,33 @@
}
- private String versionName;
- private String versionNumber;
- private String buildNumber;
+ private String asVersionName;
+ private String asVersionNumber;
+ private String asBuildNumber;
+
+ private String rhqVersion;
private String joprVersion;
+ private String embJoprVersion;
+ private String seamVersion;
+ private String richfacesVersion;
- public String getBuildNumber() { return buildNumber; }
- public String getVersionName() { return versionName; }
- public String getVersionNumber() { return versionNumber; }
+
+ public String getAsBuildNumber() { return asBuildNumber; }
+ public String getAsVersionName() { return asVersionName; }
+ public String getAsVersionNumber() { return asVersionNumber; }
+
+ public String getRhqVersion() { return rhqVersion; }
public String getJoprVersion() { return joprVersion; }
+ public String getEmbJoprVersion() { return embJoprVersion; }
+ public String getRichfacesVersion() { return richfacesVersion; }
+ public String getSeamVersion() { return seamVersion; }
- public boolean isEAP(){ return "EAP".equals( this.versionName ); }
+ public boolean isEAP(){ return "EAP".equals( this.asVersionName ); }
public String toString(){
- return String.format("EJTS environment info:\n versionName: %s\n versionNumber: %s\n buildNumber: %s\n Jopr Version: %s",
- versionName, versionNumber, buildNumber, joprVersion
+ return String.format("EJTS environment info:\n AS versionName: %s\n AS versionNumber: %s\n AS buildNumber: %s" +
+ "\n RHQ Version: %s\n Jopr Version: %s\n EmbJopr Version: %s\n Seam Version: %s\n RichFaces Version: %s",
+ asVersionName, asVersionNumber, asBuildNumber, rhqVersion, joprVersion, embJoprVersion, seamVersion, richfacesVersion
);
}
@@ -64,17 +81,45 @@
public static EjtsEnvironmentInfo createFromLocalServer() throws Exception
{
EjtsEnvironmentInfo envInfo = new EjtsEnvironmentInfo();
+
+ // Server info
try {
JMXUtils jmx = JMXUtils.getInstanceForLocalJBoss();
- envInfo.versionName = (String) jmx.getMBeanAttribute("jboss.system:type=Server", "VersionName");
- envInfo.versionNumber = (String) jmx.getMBeanAttribute("jboss.system:type=Server", "VersionNumber");
- envInfo.buildNumber = (String) jmx.getMBeanAttribute("jboss.system:type=Server", "BuildNumber");
+ envInfo.asVersionName = (String) jmx.getMBeanAttribute("jboss.system:type=Server", "VersionName");
+ envInfo.asVersionNumber = (String) jmx.getMBeanAttribute("jboss.system:type=Server", "VersionNumber");
+ envInfo.asBuildNumber = (String) jmx.getMBeanAttribute("jboss.system:type=Server", "BuildNumber");
}catch ( Exception ex ){
throw new Exception("Error getting server info via JMX: "+ex.getMessage(), ex);
}
- envInfo.joprVersion = System.getProperty("jopr.version");
+ //envInfo.joprVersion = System.getProperty("jopr.version");
+ /*
+ envInfo.joprVersion = EjtsEnvironmentInfo.class.getPackage().getImplementationVersion();
+ envInfo.embJoprVersion = EjtsEnvironmentInfo.class.getPackage().getImplementationVersion();
+ /*/
+ //Manifest mf = new Manifest( EjtsEnvironmentInfo.class.getResourceAsStream("/META-INF/MANIFEST.MF") );
+ // OMG! http://forums.sun.com/thread.jspa?threadID=642761
+ String classContainer = EjtsEnvironmentInfo.class.getProtectionDomain().getCodeSource().getLocation().toString();
+ String urlString;
+ if( true /* EXPLODED */ ){
+ urlString = classContainer + "../../META-INF/MANIFEST.MF";
+ }else{
+ urlString = "jar:"+classContainer+"!/META-INF/MANIFEST.MF";
+ }
+
+ URL manifestUrl = new URL( urlString );
+ Manifest manifest = new Manifest(manifestUrl.openStream());
+
+ Attributes attrs = manifest.getMainAttributes();
+ envInfo.rhqVersion = (String) attrs.getValue("rhq-version");
+ envInfo.joprVersion = attrs.getValue("jopr-version");
+ envInfo.embJoprVersion = attrs.getValue("embjopr-version");
+ envInfo.seamVersion = attrs.getValue("seam-version");
+ envInfo.richfacesVersion = attrs.getValue("richfaces-version");
+ //envInfo.Version = attrs.getValue(".version");
+
+
return envInfo;
}
@@ -84,29 +129,78 @@
* Compares two version strings, like compareTo() does.
* TODO: Maven comparison algorithm works bad; Code own one.
*/
- public static int compareVersions(String v1s, String v2s){
+ public static int compareVersions(String aStr, String bStr){
- /*
- int v1n = 0;
- int v2n = 0;
+ //*
+ String[] aParts = StringUtils.split(aStr.toUpperCase(), ".-_");
+ String[] bParts = StringUtils.split(bStr.toUpperCase(), ".-_");
- String[] v1parts = StringUtils.split(v1, ".-");
- String[] v2parts = StringUtils.split(v2, ".-");
+ int aOff= 0;
+ int bOff = 0;
- int longer =
+ //int longer = 0;
+ //for( int i = v1parts.length-1; i >= 0; i--){ }
- for( int i = v1parts.length-1; i >= 0; i--){
- }
+ do {
+ String a = aParts[aOff];
+ String b = bParts[bOff];
+
+ if( "GA".equals(a) ) a = "0";
+ if( "GA".equals(b) ) b = "0";
- throw new UnsupportedOperationException();
- */
+ boolean aIsNum = NumberUtils.isDigits( a );
+ boolean bIsNum = NumberUtils.isDigits( b );
+ Integer aNum = aIsNum ? NumberUtils.createInteger( a ) : null;
+ Integer bNum = bIsNum ? NumberUtils.createInteger( b ) : null;
+ if( aIsNum && bIsNum ){
+ int diff = aNum - bNum;
+ // Different numbers - return the diff.
+ if( diff != 0 ) return diff;
+ // The same numbers - skip to next position.
+ aOff++; bOff++; continue;
+ }
+
+ else if( aIsNum ^ bIsNum ){
+
+ if( aIsNum ){
+ // Skip aditional "decimal" zeros - e.g. 2.0.0.FOO vs. 2.0.BAR .
+ if ( aNum == 0 ){ aOff++; continue; }
+ // A non-zero number is always bigger than any string (except GA).
+ else { return 1; }
+ }
+
+ else /* vice versa for ( bIsNum ) */ {
+ // Skip aditional "decimal" zeros - e.g. 2.0.0.FOO vs. 2.0.BAR .
+ if ( bNum == 0 ){ bOff++; continue; }
+ // A non-zero number is always bigger than any string (except GA).
+ else { return -1; }
+ }
+ }
+
+ // Neither is a number -> Compare two strings.
+ return a.compareTo(b);
+
+
+ } while( aOff < aParts.length && bOff < bParts.length );
+
+ /*
// Maven's algorithm.
DefaultArtifactVersion v1 = new DefaultArtifactVersion(v1s);
DefaultArtifactVersion v2 = new DefaultArtifactVersion(v2s);
return v1.compareTo(v2);
+ /**/
}
+ class VersionInfo{
+ public VersionInfo( String str ){
+
+
+ }
+
+ }
+
+
}// class
15 years, 1 month
EMBJOPR SVN: r849 - in trunk/jsfunit: src/build/resources and 1 other directory.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-11-07 02:24:09 -0500 (Sat, 07 Nov 2009)
New Revision: 849
Modified:
trunk/jsfunit/pom.xml
trunk/jsfunit/src/build/resources/switch-web.xml-to-myfaces.xsl
Log:
* POM: Workaround for Maven XML plugin bug (MOJO-1453)
* XSLT: Workadound for Java implementation which doesn't allow to have "-" in the node name.
Modified: trunk/jsfunit/pom.xml
===================================================================
--- trunk/jsfunit/pom.xml 2009-11-07 05:55:37 UTC (rev 848)
+++ trunk/jsfunit/pom.xml 2009-11-07 07:24:09 UTC (rev 849)
@@ -851,20 +851,19 @@
<executions>
<execution>
<id>switch-web.xml-to-myfaces</id> <goals> <goal>transform</goal> </goals>
- <phase>process-resources</phase>
+ <phase>package</phase>
<configuration>
<transformationSets>
- <outputDir>${basedir}/testdata</outputDir>
- <!-- http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/transform/Trans... -->
- <!-- javax.xml.transform.OutputKeys.INDENT -->
- <outputProperties>
- <outputProperty> <name>{http://xml.apache.org/xslt}indent-amount</name><value>4</value> </outputProperty>
- <outputProperty> <name>indent</name><value>yes</value> </outputProperty>
- </outputProperties>
<transformationSet>
- <stylesheet>${basedir}/src/build/resources/switch-web.xml-to-myfaces.xslt</stylesheet>
+ <outputDir>${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5</outputDir> <!-- /WEB-INF: http://jira.codehaus.org/browse/MOJO-1453 -->
+ <!-- javax.xml.transform.OutputKeys.INDENT -->
+ <outputProperties>
+ <outputProperty> <name>{http://xml.apache.org/xslt}indent-amount</name><value>4</value> </outputProperty>
+ <outputProperty> <name>indent</name><value>yes</value> </outputProperty>
+ </outputProperties>
+ <stylesheet>${basedir}/src/build/resources/switch-web.xml-to-myfaces.xsl</stylesheet>
<dir>${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/WEB-INF</dir>
- <includes>web.xml</includes>
+ <includes><include>web.xml</include></includes>
</transformationSet>
</transformationSets>
</configuration>
@@ -872,6 +871,24 @@
</executions>
</plugin>
+ <!-- AntRun - move the modified web.xml - overwrite the original (MOJO-1453 workaround) . -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <!-- This has to be named this way, otherwise it would execute AFTER web.xml XSLT processing. That's Maven. -->
+ <id>delete_bundled_admin_console_war</id> <!-- move-new-web.xml-overwrite-the-original-one -->
+ <phase>package</phase>
+ <configuration><tasks>
+ <echo>Moving ${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/web.xml to ${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/WEB-INF/web.xml</echo>
+ <move file="${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/web.xml" todir="${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/WEB-INF" />
+ </tasks></configuration>
+ <goals><goal>run</goal></goals>
+ </execution>
+ </executions>
+ </plugin>
+
</plugins>
</build>
</profile>
Modified: trunk/jsfunit/src/build/resources/switch-web.xml-to-myfaces.xsl
===================================================================
--- trunk/jsfunit/src/build/resources/switch-web.xml-to-myfaces.xsl 2009-11-07 05:55:37 UTC (rev 848)
+++ trunk/jsfunit/src/build/resources/switch-web.xml-to-myfaces.xsl 2009-11-07 07:24:09 UTC (rev 849)
@@ -10,14 +10,11 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml"/>
- <xsl:template match="@*|node()">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
- </xsl:template>
+
<!-- Add org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL after last context-param. -->
- <xsl:template match="/web-app/context-param[position()=last()]">
+ <!-- /web-app/context-param[position()=last()] -->
+ <xsl:template match="/*[name()='web-app']/*[name()='context-param' and position()=1]">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
@@ -30,11 +27,25 @@
<param-value>true</param-value>
</context-param>
</xsl:template>
+ <!-- TEST
+ <xsl:template match="X/*[name()='web-app']/*[name()='context-param' and position() = (1) ]">
+ FOO <xsl:value-of select="last()"/>
+ </xsl:template>
+ -->
+
+
<!-- Replace RichFaces listener with MyFaces -->
<!-- <listener-class>com.sun.faces.config.ConfigureListener</listener-class> -->
- <xsl:template match="/web-app/listener/listener-class[contains( normalize-space(), 'com.sun.faces.config.ConfigureListener' )]">
+ <xsl:template match="/*[name()='web-app']/*/*[name()='listener-class' and contains( normalize-space(), 'com.sun.faces.config.ConfigureListener' )]">
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</xsl:template>
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+
</xsl:stylesheet>
15 years, 1 month
EMBJOPR SVN: r848 - in trunk/jsfunit: src/build/resources and 1 other directory.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-11-07 00:55:37 -0500 (Sat, 07 Nov 2009)
New Revision: 848
Added:
trunk/jsfunit/src/build/resources/switch-web.xml-to-myfaces.xsl
Modified:
trunk/jsfunit/pom.xml
Log:
* POM: Created "myfaces" profile which modifies web.xml and adds MyFaces to the dependencies.
Modified: trunk/jsfunit/pom.xml
===================================================================
--- trunk/jsfunit/pom.xml 2009-11-07 05:38:06 UTC (rev 847)
+++ trunk/jsfunit/pom.xml 2009-11-07 05:55:37 UTC (rev 848)
@@ -813,6 +813,73 @@
</profile>
+
+
+ <!-- MyFaces - workaround for AS 5.2 w/ JSF 2.0 -->
+ <profile>
+ <id>myfaces</id>
+ <dependencies>
+ <dependency>
+ <groupId>apache-myfaces</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>1.2.7</version>
+ </dependency>
+ <dependency>
+ <groupId>apache-myfaces</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>1.2.7</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ </dependency>
+ <dependency>
+ <groupId>apache-discovery</groupId>
+ <artifactId>commons-discovery</artifactId>
+ <version>0.4-brew</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <!-- TODO: Change web.xml to set up MyFaces instead of RichFaces.
+ http://fisheye.jboss.org/browse/EMBJOPR/branches/EmbJopr_1_3_3_MyFaces/co...>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>xml-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>switch-web.xml-to-myfaces</id> <goals> <goal>transform</goal> </goals>
+ <phase>process-resources</phase>
+ <configuration>
+ <transformationSets>
+ <outputDir>${basedir}/testdata</outputDir>
+ <!-- http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/transform/Trans... -->
+ <!-- javax.xml.transform.OutputKeys.INDENT -->
+ <outputProperties>
+ <outputProperty> <name>{http://xml.apache.org/xslt}indent-amount</name><value>4</value> </outputProperty>
+ <outputProperty> <name>indent</name><value>yes</value> </outputProperty>
+ </outputProperties>
+ <transformationSet>
+ <stylesheet>${basedir}/src/build/resources/switch-web.xml-to-myfaces.xslt</stylesheet>
+ <dir>${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/WEB-INF</dir>
+ <includes>web.xml</includes>
+ </transformationSet>
+ </transformationSets>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+
+
+
+
+
<!-- Hudson profile (commented out - hesitating to hard-code version dir to pom.xml)
<profile>
<id>running-in-hudson</id>
@@ -845,6 +912,10 @@
<directory>${basedir}/testdata</directory>
<excludes><exclude>**/*</exclude></excludes>
</resource>
+ <resource>
+ <directory>${basedir}/src/build/resources</directory>
+ <excludes><exclude>**/*</exclude></excludes>
+ </resource>
</resources>
Added: trunk/jsfunit/src/build/resources/switch-web.xml-to-myfaces.xsl
===================================================================
--- trunk/jsfunit/src/build/resources/switch-web.xml-to-myfaces.xsl (rev 0)
+++ trunk/jsfunit/src/build/resources/switch-web.xml-to-myfaces.xsl 2009-11-07 05:55:37 UTC (rev 848)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Document : switch-web.xml-to-myfaces.xsl
+ Author : Ondra Zizka
+ Description:
+ Modifies web.xml to use MyFaces instead of RichFaces.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <xsl:output method="xml"/>
+
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <!-- Add org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL after last context-param. -->
+ <xsl:template match="/web-app/context-param[position()=last()]">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ <xsl:comment>
+ This special version of web.xml allows Embedded Jopr to use MyFaces
+ instead of the built-in Mojarra JSF implementaiton.
+ </xsl:comment>
+ <context-param>
+ <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ </xsl:template>
+
+ <!-- Replace RichFaces listener with MyFaces -->
+ <!-- <listener-class>com.sun.faces.config.ConfigureListener</listener-class> -->
+ <xsl:template match="/web-app/listener/listener-class[contains( normalize-space(), 'com.sun.faces.config.ConfigureListener' )]">
+ <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
+ </xsl:template>
+
+</xsl:stylesheet>
15 years, 1 month
EMBJOPR SVN: r847 - in trunk/jsfunit: src/test/java/org/jboss/jopr/jsfunit and 1 other directories.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-11-07 00:38:06 -0500 (Sat, 07 Nov 2009)
New Revision: 847
Added:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EjtsSelfTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/Labels.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java
Modified:
trunk/jsfunit/pom.xml
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbJoprTestConstants.java
Log:
* Server edition and version, and Jopr version used to adjust strings and testuite behavior dynamicaly. (JBQA-2770, JBQA-2774)
* But still using the constants - first we have to tune up the metadata.
Modified: trunk/jsfunit/pom.xml
===================================================================
--- trunk/jsfunit/pom.xml 2009-11-07 05:35:43 UTC (rev 846)
+++ trunk/jsfunit/pom.xml 2009-11-07 05:38:06 UTC (rev 847)
@@ -8,7 +8,6 @@
<!-- Does not work in Maven 2.2.1 -->
<mavenConflictResolvers>newest,nearest</mavenConflictResolvers>
- <jopr.version>1.2.0-SNAPSHOT</jopr.version>
<cargo.plugin.version>1.0.1-SNAPSHOT</cargo.plugin.version>
<jvm.args.debug></jvm.args.debug> <!-- Used by the -Pdebug profile. -->
<jvm.args.profiler></jvm.args.profiler> <!-- Used by the -Pprofile profile. -->
@@ -111,6 +110,14 @@
<scope>compile</scope>
<version>1.7R2</version>
</dependency>
+
+ <!-- For version comparison -->
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>2.2.1</version>
+ <scope>compile</scope>
+ </dependency>
<dependency>
<groupId>org.jboss.jsfunit</groupId>
@@ -247,6 +254,7 @@
<jboss.bind.address>${cargo.jboss.bind.address}</jboss.bind.address>
<jsfunit.jboss.home.dir>${basedir}/target/jboss42x</jsfunit.jboss.home.dir>
<htmlunit.browser>${htmlunit.browser}</htmlunit.browser>
+ <jopr.version>${jopr.version}</jopr.version>
</systemProperties>
</container>
@@ -466,6 +474,7 @@
<htmlunit.browser>${htmlunit.browser}</htmlunit.browser>
<jsfunit.jboss.isSecured>${jboss.isSecured}</jsfunit.jboss.isSecured>
<jboss.platform.mbeanserver>true</jboss.platform.mbeanserver> <!-- Makes the JVM resource appear. -->
+ <jopr.version>${jopr.version}</jopr.version>
</systemProperties>
</container>
@@ -821,12 +830,18 @@
<build>
<finalName>admin-console-jsfunit</finalName>
+ <!-- Intentionally set to the same dir:
+ We need the classes as sources to include them in the WAR.
+ We need them as tests to let the Surefire plugin run them. -->
<sourceDirectory>src/test/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<!-- To add the dir to IDEs nav tree. -->
<resources>
<resource>
+ <directory>${basedir}/src/main/resources</directory>
+ </resource>
+ <resource>
<directory>${basedir}/testdata</directory>
<excludes><exclude>**/*</exclude></excludes>
</resource>
Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EjtsSelfTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EjtsSelfTest.java (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EjtsSelfTest.java 2009-11-07 05:38:06 UTC (rev 847)
@@ -0,0 +1,50 @@
+
+package org.jboss.jopr.jsfunit;
+
+import org.apache.cactus.ServletTestCase;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+import org.jboss.jopr.jsfunit.util.EjtsEnvironmentInfo;
+import org.jboss.logging.Logger;
+
+/**
+ *
+ * @author ondra
+ */
+public class EjtsSelfTest extends ServletTestCase {
+
+ private static final Logger log = Logger.getLogger( EjtsSelfTest.class.getName() );
+
+ /** */
+ public void testEnvironmentInfo() throws EmbJoprTestException, Exception {
+ EjtsEnvironmentInfo eei = EjtsEnvironmentInfo.createFromLocalServer();
+ log.info( eei.toString() );
+
+ doCompareVersions("2.3.0.GA", "2.4.0-SNAPSHOT", -1);
+ doCompareVersions("2.4.0.GA", "2.4.0-SNAPSHOT", 1);
+ doCompareVersions("2.4.1.GA", "2.4.0-SNAPSHOT", 1);
+ doCompareVersions("2.4.1", "2.4.0-SNAPSHOT", 1);
+ doCompareVersions("2.4.0", "2.4.0-SNAPSHOT", 1);
+ doCompareVersions("2.4.0", "2.4.0.GA", 0);
+ doCompareVersions("2.4.0.CR1", "2.4.0.GA", -1);
+ doCompareVersions("2.4.CR1", "2.4.0.GA", -1);
+ doCompareVersions("2.4.CR1", "2.4.0", -1);
+ }
+
+ private void doCompareVersions( String v1, String v2, int expectedSignum ){
+ log.info( String.format("Comparing versions: %s and %s produces: %d", v1, v2, EjtsEnvironmentInfo.compareVersions(v1, v2) ) );
+ }
+
+
+
+ /** */
+ public void testLabels() throws EmbJoprTestException, Exception {
+ Labels labels = Labels.createDefault();
+ log.info( labels.toString() );
+ }
+
+
+}// class
+
+
+
+
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbJoprTestConstants.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbJoprTestConstants.java 2009-11-07 05:35:43 UTC (rev 846)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbJoprTestConstants.java 2009-11-07 05:38:06 UTC (rev 847)
@@ -1,13 +1,10 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
package org.jboss.jopr.jsfunit;
/**
- *
- * @author Ondrej Zizka
+ * TODO: Values copied to .properties files yet, (JBQA-2770, JBQA-2774), but still using this file.
+ *
+ * @author Ondrej Zizka
*/
public interface EmbJoprTestConstants {
Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/Labels.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/Labels.java (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/Labels.java 2009-11-07 05:38:06 UTC (rev 847)
@@ -0,0 +1,136 @@
+package org.jboss.jopr.jsfunit;
+
+import java.io.*;
+import java.net.URL;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.Set;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.math.NumberUtils;
+import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
+import org.jboss.jopr.jsfunit.util.EjtsEnvironmentInfo;
+import org.jboss.logging.Logger;
+
+/**
+ *
+ * @author Ondrej Zizka
+ */
+public class Labels
+{
+
+ private static final Logger log = Logger.getLogger( Labels.class.getName() );
+
+
+ Properties props; // = new Properties();
+
+ private Labels(){}
+
+
+ /**
+ * Returns a properties object with labels for the current environment:
+ * Server edition and version, Jopr version.
+ */
+ public static Labels createDefault() throws Exception
+ {
+
+ Labels ret = new Labels();
+
+ // Common
+ ret.props = loadProperties("labels--common.properties");
+
+ EjtsEnvironmentInfo si = EjtsEnvironmentInfo.getInstance();
+ //String joprVersion = JBossASDiscoveryComponent.class.getPackage().getVersion();
+ String curJoprVersion = System.getProperty("jopr.version");
+
+
+
+ // EAP / AS
+ String serverEdition = si.isEAP() ? "eap" : "as";
+
+ String editionPropsFile = "labels-"+serverEdition+".properties";
+ ret.mergeProperties( loadProperties( editionPropsFile ) ) ;
+
+ // Incrementally apply version updates.
+
+ // EAP / AS version.
+ for( String buildNumber : StringUtils.split("") ){ // TODO: Load dynamically.
+ if( NumberUtils.toLong(buildNumber) > NumberUtils.toLong(si.getBuildNumber()) )
+ break;
+ String buildPropsFile = "labels-"+serverEdition+"-"+buildNumber+".properties";
+ ret.mergeProperties( loadProperties( buildPropsFile ) ) ;
+ }
+
+ // JOPR
+ for( String joprVersion : StringUtils.split("2.3.0.GA") ){ // TODO: Load dynamically.
+ if( EjtsEnvironmentInfo.compareVersions(joprVersion, curJoprVersion) > 0 )
+ break;
+ String buildPropsFile = "labels-jopr-"+joprVersion+".properties";
+ ret.mergeProperties( loadProperties( buildPropsFile ) ) ;
+ }
+
+ return ret;
+
+ }
+
+
+
+ /** Merge properties - rewrite old ones with the new ones. */
+ public void mergeProperties( Properties props ){
+ for( Entry e : props.entrySet() ){
+ this.props.setProperty( (String)e.getKey(), (String)e.getValue() );
+ }
+ }
+
+
+ /** Loads properties. */
+ public static Properties loadProperties(String name) throws IOException {
+ try {
+ InputStream in = getInputStream(name);
+ Properties props = new Properties();
+ props.load(in);
+ in.close();
+ return props;
+ } catch (IOException ex) {
+ throw ex;
+ }
+ }
+
+ /** Open input stream for given classpath resource. */
+ protected static InputStream getInputStream( String path ) throws IOException
+ {
+ //ClassLoader loader = ClassLoader.getSystemClassLoader();
+ ClassLoader loader = Labels.class.getClassLoader();
+ if (loader == null)
+ return null;
+
+ URL url = loader.getResource(path);
+ if (url == null)
+ url = loader.getResource("/" + path);
+ if (url == null)
+ throw new IOException("Not found on classpath: "+path);
+
+ try {
+ InputStream in = url.openStream();
+ return in;
+ } catch (IOException ex) {
+ throw ex;
+ }
+ }
+
+
+
+
+ /** toString() */
+ public String toString(){
+ StringBuilder sb = new StringBuilder();
+ Set<Entry<Object, Object>> entrySet = this.props.entrySet();
+ for( Entry<Object, Object> entry : entrySet ){
+ sb.append(" ").append(entry.getKey()).append(" = ").append(entry.getValue()).append("\n");
+ }
+ return sb.toString();
+ }
+
+
+}// class
+
+
Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EjtsEnvironmentInfo.java 2009-11-07 05:38:06 UTC (rev 847)
@@ -0,0 +1,112 @@
+/*
+
+VersionNumber 5.0.0.GA
+VersionName EAP
+BuildDate 20091020
+BuildNumber 200910202128
+
+Started True
+BuildOS Linux(amd64,2.6.18-164.2.1.el5)
+BuildID 200910202128
+InShutdown False
+StartDate Wed, 4 Nov 2009 16:00:16 +0100
+BuildJVM 14.1-b02(Sun Microsystems Inc.)
+MetaData {}
+Version 5.0.0.GA (build: SVNTag=JBPAPP_5_0_0_GA date=200910202128)
+
+*/
+
+
+package org.jboss.jopr.jsfunit.util;
+
+import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
+import org.jboss.jopr.jsfunit.JMXUtils;
+
+/**
+ *
+ * @author Ondrej Zizka
+ */
+public class EjtsEnvironmentInfo
+{
+
+ private static EjtsEnvironmentInfo INSTANCE;
+ public static EjtsEnvironmentInfo getInstance() throws Exception {
+ if( null == INSTANCE )
+ INSTANCE = createFromLocalServer();
+ return INSTANCE;
+ }
+
+
+ private String versionName;
+ private String versionNumber;
+ private String buildNumber;
+ private String joprVersion;
+
+ public String getBuildNumber() { return buildNumber; }
+ public String getVersionName() { return versionName; }
+ public String getVersionNumber() { return versionNumber; }
+ public String getJoprVersion() { return joprVersion; }
+
+ public boolean isEAP(){ return "EAP".equals( this.versionName ); }
+
+ public String toString(){
+ return String.format("EJTS environment info:\n versionName: %s\n versionNumber: %s\n buildNumber: %s\n Jopr Version: %s",
+ versionName, versionNumber, buildNumber, joprVersion
+ );
+ }
+
+
+
+
+ /**
+ * Creates an instance from local running JBoss AS.
+ */
+ public static EjtsEnvironmentInfo createFromLocalServer() throws Exception
+ {
+ EjtsEnvironmentInfo envInfo = new EjtsEnvironmentInfo();
+ try {
+ JMXUtils jmx = JMXUtils.getInstanceForLocalJBoss();
+ envInfo.versionName = (String) jmx.getMBeanAttribute("jboss.system:type=Server", "VersionName");
+ envInfo.versionNumber = (String) jmx.getMBeanAttribute("jboss.system:type=Server", "VersionNumber");
+ envInfo.buildNumber = (String) jmx.getMBeanAttribute("jboss.system:type=Server", "BuildNumber");
+ }catch ( Exception ex ){
+ throw new Exception("Error getting server info via JMX: "+ex.getMessage(), ex);
+ }
+
+ envInfo.joprVersion = System.getProperty("jopr.version");
+
+ return envInfo;
+ }
+
+
+
+ /**
+ * Compares two version strings, like compareTo() does.
+ * TODO: Maven comparison algorithm works bad; Code own one.
+ */
+ public static int compareVersions(String v1s, String v2s){
+
+ /*
+ int v1n = 0;
+ int v2n = 0;
+
+ String[] v1parts = StringUtils.split(v1, ".-");
+ String[] v2parts = StringUtils.split(v2, ".-");
+
+ int longer =
+
+ for( int i = v1parts.length-1; i >= 0; i--){
+ }
+
+ throw new UnsupportedOperationException();
+ */
+
+ // Maven's algorithm.
+ DefaultArtifactVersion v1 = new DefaultArtifactVersion(v1s);
+ DefaultArtifactVersion v2 = new DefaultArtifactVersion(v2s);
+ return v1.compareTo(v2);
+ }
+
+
+
+}// class
15 years, 1 month