Author: chris.laprun(a)jboss.com
Date: 2010-04-26 06:11:04 -0400 (Mon, 26 Apr 2010)
New Revision: 2770
Added:
components/wsrp/trunk/common/src/main/resources/
components/wsrp/trunk/common/src/main/resources/wsrp.properties
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPConstantsTestCase.java
Modified:
components/wsrp/trunk/UpdateWSRPForGateIn.sh
components/wsrp/trunk/common/pom.xml
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPConstants.java
Log:
- GTNWSRP-32: Automated changing WSRP service version via Maven.
- Removed version checking in UpdateWSRPForGatein.sh as it's now automated via Maven.
Modified: components/wsrp/trunk/UpdateWSRPForGateIn.sh
===================================================================
--- components/wsrp/trunk/UpdateWSRPForGateIn.sh 2010-04-26 09:52:25 UTC (rev 2769)
+++ components/wsrp/trunk/UpdateWSRPForGateIn.sh 2010-04-26 10:11:04 UTC (rev 2770)
@@ -40,14 +40,6 @@
echo Current WSRP version in project POM: \'$CURRENT_WSRP\'
echo
-# Check that WSRP service version as defined by WSRPConstants.WSRP_SERVICE_VERSION is in
sync with project POM
-WSRP_SERVICE_VERSION=`grep WSRP_SERVICE_VERSION
common/src/main/java/org/gatein/wsrp/WSRPConstants.java | sed -n -e
's/.*"\(.*\)".*/\1/p'`
-if [ $WSRP_SERVICE_VERSION != $CURRENT_WSRP ]
-then
- echo \=\=\> Please update WSRPConstants.WSRP_SERVICE_VERSION
\($WSRP_SERVICE_VERSION\) as it doesn\'t match the value in the project POM
- exit
-fi
-
# If we have no argument, build. If you don't want to build just add an argument
(value irrelevant) when calling the script
if [ $# -eq 0 ]
then
Modified: components/wsrp/trunk/common/pom.xml
===================================================================
--- components/wsrp/trunk/common/pom.xml 2010-04-26 09:52:25 UTC (rev 2769)
+++ components/wsrp/trunk/common/pom.xml 2010-04-26 10:11:04 UTC (rev 2770)
@@ -20,7 +20,8 @@
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-->
-<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
@@ -74,4 +75,13 @@
<scope>test</scope>
</dependency>
</dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </build>
</project>
\ No newline at end of file
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPConstants.java
===================================================================
---
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPConstants.java 2010-04-26
09:52:25 UTC (rev 2769)
+++
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPConstants.java 2010-04-26
10:11:04 UTC (rev 2770)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
* contributors as indicated by the @authors tag. See the
* copyright.txt in the distribution for a full listing of
* individual contributors.
@@ -26,12 +26,14 @@
import org.gatein.pc.api.spi.PortalContext;
import javax.xml.namespace.QName;
+import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
+import java.util.Properties;
import java.util.Random;
/**
@@ -43,16 +45,33 @@
{
// JMX
**************************************************************************************************************
/** JMX object name for the Portal web app registry */
- @Deprecated public static final String WEB_APP_REGISTRY_OBJECT_NAME =
"portal:service=WebAppRegistry";
+ @Deprecated
+ public static final String WEB_APP_REGISTRY_OBJECT_NAME =
"portal:service=WebAppRegistry";
/** JMX object name for the WSRP Producer */
- @Deprecated public static final String WSRP_PRODUCER_OBJECT_NAME =
"portletcontainer.wsrp:service=WSRPProducer";
+ @Deprecated
+ public static final String WSRP_PRODUCER_OBJECT_NAME =
"portletcontainer.wsrp:service=WSRPProducer";
/**
- * The version of the WSRP service. This should match the maven version of the module.
Right now, checked via
- * the UpdateWSRPForGatein.sh script.
+ * The version of the WSRP service. This should match the maven version of the module.
Right now, checked via the
+ * UpdateWSRPForGatein.sh script.
*/
- public static final String WSRP_SERVICE_VERSION = "1.1.0-CR02-SNAPSHOT";
+ public static final String WSRP_SERVICE_VERSION;
+ static
+ {
+ Properties props = new Properties();
+ try
+ {
+
props.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("wsrp.properties"));
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Could not load wsrp.properties.");
+ }
+ WSRP_SERVICE_VERSION = props.getProperty("wsrp.service.version");
+ }
+
+
// Window State Names
***********************************************************************************************
/**
Added: components/wsrp/trunk/common/src/main/resources/wsrp.properties
===================================================================
--- components/wsrp/trunk/common/src/main/resources/wsrp.properties
(rev 0)
+++ components/wsrp/trunk/common/src/main/resources/wsrp.properties 2010-04-26 10:11:04
UTC (rev 2770)
@@ -0,0 +1,23 @@
+#
+# JBoss, a division of Red Hat
+# Copyright 2010, Red Hat Middleware, LLC, and individual
+# contributors as indicated by the @authors tag. See the
+# copyright.txt 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.
+#
+wsrp.service.version=${project.version}
Added:
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPConstantsTestCase.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPConstantsTestCase.java
(rev 0)
+++
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPConstantsTestCase.java 2010-04-26
10:11:04 UTC (rev 2770)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt 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.gatein.wsrp;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class WSRPConstantsTestCase extends TestCase
+{
+ public void testServiceVersion()
+ {
+ // should be equals to the interpolated ${project.version} value,
"1.1.0-CR02-SNAPSHOT" when written
+ // assertEquals("1.1.0-CR02-SNAPSHOT",
WSRPConstants.WSRP_SERVICE_VERSION);
+
assertFalse(WSRPConstants.WSRP_SERVICE_VERSION.equals("${project.version}"));
+ }
+}