[jboss-cvs] JBossAS SVN: r95836 - in projects/bootstrap/trunk: impl-as/src/main/java/org/jboss/bootstrap/impl/as/config and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Oct 30 11:09:20 EDT 2009


Author: ALRubinger
Date: 2009-10-30 11:09:19 -0400 (Fri, 30 Oct 2009)
New Revision: 95836

Added:
   projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASServerConfigProvider.java
Modified:
   projects/bootstrap/trunk/impl-as/pom.xml
   projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/BasicJBossASServerConfig.java
   projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/server/JBossASServerVersionInformationTestCase.java
Log:
[JBBOOT-115] AS ServerConfig.getSpecificationVersion must return the version of the AS server, not the package specification

Modified: projects/bootstrap/trunk/impl-as/pom.xml
===================================================================
--- projects/bootstrap/trunk/impl-as/pom.xml	2009-10-30 15:07:46 UTC (rev 95835)
+++ projects/bootstrap/trunk/impl-as/pom.xml	2009-10-30 15:09:19 UTC (rev 95836)
@@ -26,7 +26,7 @@
 
     <!-- Versions -->
     <version.org.jboss.bootstrap_jboss.bootstrap.impl.mc>2.0.0-alpha-3</version.org.jboss.bootstrap_jboss.bootstrap.impl.mc>
-    <version.org.jboss.bootstrap_jboss.bootstrap.spi.as>2.0.0-alpha-4</version.org.jboss.bootstrap_jboss.bootstrap.spi.as>
+    <version.org.jboss.bootstrap_jboss.bootstrap.spi.as>2.0.0-SNAPSHOT</version.org.jboss.bootstrap_jboss.bootstrap.spi.as>
     <!-- REMOVE: JBBOOT-68 -->
     <version.org.jboss_jboss.vfs>2.2.0.M4</version.org.jboss_jboss.vfs>
 

Modified: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/BasicJBossASServerConfig.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/BasicJBossASServerConfig.java	2009-10-30 15:07:46 UTC (rev 95835)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/BasicJBossASServerConfig.java	2009-10-30 15:09:19 UTC (rev 95836)
@@ -30,7 +30,9 @@
 import java.net.URL;
 
 import org.jboss.bootstrap.api.as.config.JBossASServerConfig;
+import org.jboss.bootstrap.impl.as.server.ASVersion;
 import org.jboss.bootstrap.impl.base.config.AbstractBasicServerConfig;
+import org.jboss.bootstrap.spi.as.config.JBossASServerConfigProvider;
 import org.jboss.logging.Logger;
 import org.jboss.managed.api.annotation.ManagementComponent;
 import org.jboss.managed.api.annotation.ManagementObject;
@@ -57,7 +59,7 @@
 @ManagementObject(name = "jboss.system:type=ServerConfig", isRuntime = true, properties = ManagementProperties.EXPLICIT, description = "provides a view of server config information", componentType = @ManagementComponent(type = "MCBean", subtype = "*"))
 public class BasicJBossASServerConfig extends AbstractBasicServerConfig<JBossASServerConfig>
       implements
-         JBossASServerConfig
+         JBossASServerConfigProvider
 {
    //-------------------------------------------------------------------------------||
    // Class Members ----------------------------------------------------------------||
@@ -170,7 +172,7 @@
     * Specification version of this package.  Not synchronized
     * as its state is set only in the constructor.
     */
-   private volatile String specificationVersion;
+   private String specificationVersion;
 
    /**
     * Partition name this instance uses when taking
@@ -230,8 +232,7 @@
       super(JBossASServerConfig.class);
 
       // Set specification version
-      final Package thisPackage = getClass().getPackage();
-      specificationVersion = thisPackage.getSpecificationVersion();
+      specificationVersion = ASVersion.getInstance().getVersionNumber();
    }
 
    //-------------------------------------------------------------------------------||
@@ -810,9 +811,11 @@
     * Obtains the specification version, exposing as a managed property
     * 
     * JBBOOT-93
+    * JBBOOT-115
     * 
     * @return
     */
+   @Override
    @ManagementProperty(description = "the server Specification-Version", readOnly = true)
    public String getSpecificationVersion()
    {

Modified: projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/server/JBossASServerVersionInformationTestCase.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/server/JBossASServerVersionInformationTestCase.java	2009-10-30 15:07:46 UTC (rev 95835)
+++ projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/server/JBossASServerVersionInformationTestCase.java	2009-10-30 15:09:19 UTC (rev 95836)
@@ -24,6 +24,7 @@
 
 import junit.framework.TestCase;
 
+import org.jboss.bootstrap.spi.as.config.JBossASServerConfigProvider;
 import org.jboss.bootstrap.spi.as.server.JBossASServerProvider;
 import org.jboss.logging.Logger;
 import org.junit.BeforeClass;
@@ -264,4 +265,24 @@
             serverInfo.contains(versionInfo));
    }
 
+   /**
+    * Ensures that the server config "getSpecificationVersion" reports
+    * the correct version of the AS Server
+    * 
+    * JBBOOT-115
+    */
+   @Test
+   public void testServerConfigReportsCorrectVersionInfo()
+   {
+      // Get the config (SPI View)
+      final JBossASServerConfigProvider serverConfig = (JBossASServerConfigProvider) server.getConfiguration();
+
+      // Get the actual and expected values
+      final String versionInfo = serverConfig.getSpecificationVersion();
+      final String expected = EXPECTED_VERSION_NUMBER;
+      log.info("Obtained specification version from server config: " + versionInfo);
+
+      // Test
+      TestCase.assertEquals("Version reported from server config was not as expected", expected, versionInfo);
+   }
 }

Added: projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASServerConfigProvider.java
===================================================================
--- projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASServerConfigProvider.java	                        (rev 0)
+++ projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASServerConfigProvider.java	2009-10-30 15:09:19 UTC (rev 95836)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, 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.bootstrap.spi.as.config;
+
+import org.jboss.bootstrap.api.as.config.JBossASServerConfig;
+
+/**
+ * JBossASServerConfigProvider
+ * 
+ * SPI Contract for implementors of a JBossAS Server Config
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface JBossASServerConfigProvider extends JBossASServerConfig
+{
+
+   //-------------------------------------------------------------------------------||
+   // Contracts --------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * Returns the Version of the AS Server represented by this configuration.
+    * 
+    * JBBOOT-115
+    */
+   String getSpecificationVersion();
+}




More information about the jboss-cvs-commits mailing list