[teiid-commits] teiid SVN: r2912 - in trunk/console/src: main/resources/META-INF and 3 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Wed Feb 16 11:28:03 EST 2011


Author: tejones
Date: 2011-02-16 11:28:02 -0500 (Wed, 16 Feb 2011)
New Revision: 2912

Added:
   trunk/console/src/test/java/org/teiid/rhq/plugin/
   trunk/console/src/test/java/org/teiid/rhq/plugin/util/
   trunk/console/src/test/java/org/teiid/rhq/plugin/util/TestDeploymentUtils.java
Modified:
   trunk/console/src/main/java/org/teiid/rhq/plugin/util/DeploymentUtils.java
   trunk/console/src/main/resources/META-INF/rhq-plugin.xml
Log:
TEIID-1437: Added dynamic VDB deployment capability

Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/util/DeploymentUtils.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/util/DeploymentUtils.java	2011-02-16 03:45:00 UTC (rev 2911)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/util/DeploymentUtils.java	2011-02-16 16:28:02 UTC (rev 2912)
@@ -46,9 +46,16 @@
         int lastPeriod = archiveFileName.lastIndexOf("."); //$NON-NLS-1$
         String extension = (lastPeriod != -1) ? archiveFileName.substring(lastPeriod + 1) : null;
         // Use File.equals() to compare the extensions so case-sensitivity is correct for this platform.
-        return (extension != null && new File(extension).equals(new File(expectedExtension)));
+        return (extension != null && new File(extension).equals(new File(expectedExtension))) || isDynamicVDB(archiveFileName);
     }
 
+    private static boolean isDynamicVDB(String archiveFileName) {
+        String dynamicFile = "-vdb.xml"; //$NON-NLS-1$
+        if (archiveFileName.length()<8) return false;
+        String fileEnding = archiveFileName.substring(archiveFileName.length()-8);
+        return (new File(dynamicFile).equals(new File(fileEnding)));
+    }
+    
     /**
      * Deploys (i.e. distributes then starts) the specified archive file.
      *

Modified: trunk/console/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- trunk/console/src/main/resources/META-INF/rhq-plugin.xml	2011-02-16 03:45:00 UTC (rev 2911)
+++ trunk/console/src/main/resources/META-INF/rhq-plugin.xml	2011-02-16 16:28:02 UTC (rev 2912)
@@ -558,7 +558,7 @@
 				displayType="summary" category="availability" property="errorCount"
 				description="Whether or not errors exist for this VDB" />
 
-			<content name="vdb" displayName="VDB Archive" category="deployable"
+			<content name="vdb" displayName="VDB File" category="deployable"
 				isCreationType="true">
 			</content>
 

Added: trunk/console/src/test/java/org/teiid/rhq/plugin/util/TestDeploymentUtils.java
===================================================================
--- trunk/console/src/test/java/org/teiid/rhq/plugin/util/TestDeploymentUtils.java	                        (rev 0)
+++ trunk/console/src/test/java/org/teiid/rhq/plugin/util/TestDeploymentUtils.java	2011-02-16 16:28:02 UTC (rev 2912)
@@ -0,0 +1,44 @@
+package org.teiid.rhq.plugin.util;
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library 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 library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+
+import junit.framework.TestCase;
+
+import org.teiid.rhq.plugin.util.DeploymentUtils;
+
+/**
+ * A set of utility methods for deploying applications.
+ *
+ */
+public class TestDeploymentUtils extends TestCase {
+   
+    public void testHasCorrectExtension() {
+       assertTrue(DeploymentUtils.hasCorrectExtension("test-vdb.xml", null));
+       assertFalse(DeploymentUtils.hasCorrectExtension("test-vdb.pdf", null));
+       assertFalse(DeploymentUtils.hasCorrectExtension("b.xml", null));
+       assertTrue(DeploymentUtils.hasCorrectExtension("my.vdb", null));
+       assertFalse(DeploymentUtils.hasCorrectExtension("My.VDB", null));
+       assertFalse(DeploymentUtils.hasCorrectExtension("a.vdbx", null));
+    }
+      
+}


Property changes on: trunk/console/src/test/java/org/teiid/rhq/plugin/util/TestDeploymentUtils.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain



More information about the teiid-commits mailing list