ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1572111 - in /ace/trunk: org.apache.ace.test/bnd.bnd org.apache.ace.test/src/org/apache/ace/it/gogo/TestDataCommands.java run-server-allinone/scripts/ run-server-allinone/scripts/clear.gogo run-server-allinone/scripts/setup.gogo
Date Wed, 26 Feb 2014 15:55:35 GMT
Author: jawi
Date: Wed Feb 26 15:55:35 2014
New Revision: 1572111

URL: http://svn.apache.org/r1572111
Log:
Several improvements to test generation commands:

- allow config files to be created with a given name;
- added script to set up and a number of bundles and config files to a running ACE instance;
- added script to clear all bundles and artifacts from a running ACE instance.


Added:
    ace/trunk/run-server-allinone/scripts/
    ace/trunk/run-server-allinone/scripts/clear.gogo
    ace/trunk/run-server-allinone/scripts/setup.gogo
Modified:
    ace/trunk/org.apache.ace.test/bnd.bnd
    ace/trunk/org.apache.ace.test/src/org/apache/ace/it/gogo/TestDataCommands.java

Modified: ace/trunk/org.apache.ace.test/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.test/bnd.bnd?rev=1572111&r1=1572110&r2=1572111&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.test/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.test/bnd.bnd Wed Feb 26 15:55:35 2014
@@ -7,6 +7,9 @@
 Export-Package: org.apache.ace.it,\
 	org.apache.ace.test.constants,\
 	org.apache.ace.test.utils
+Import-Package: \
+	junit.framework;resolution:=optional,\
+	*
 Bundle-Version: 1.0.0
 Bundle-Name: Apache ACE Test
 Bundle-Description: Provides base classes and utils for integration tests

Modified: ace/trunk/org.apache.ace.test/src/org/apache/ace/it/gogo/TestDataCommands.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.test/src/org/apache/ace/it/gogo/TestDataCommands.java?rev=1572111&r1=1572110&r2=1572111&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.test/src/org/apache/ace/it/gogo/TestDataCommands.java (original)
+++ ace/trunk/org.apache.ace.test/src/org/apache/ace/it/gogo/TestDataCommands.java Wed Feb
26 15:55:35 2014
@@ -60,14 +60,14 @@ public class TestDataCommands {
         return url.toExternalForm();
     }
 
-    @Descriptor("Generates a metatype configuration artifact with version 1.0.0")
-    public static String gca() throws Exception {
-        return gca(new String[0]);
+    @Descriptor("Generates a metatype configuration artifact")
+    public static String gca(@Descriptor("The (placeholder) property names") String[] propertyNames)
throws Exception {
+        return gca(null, propertyNames);
     }
 
-    @Descriptor("Generates a metatype configuration artifact with a given version")
-    public static String gca(@Descriptor("The (placeholder) property names") String[] propertyNames)
throws Exception {
-        URL url = generateMetaTypeArtifact(propertyNames);
+    @Descriptor("Generates a metatype configuration artifact")
+    public static String gca(@Descriptor("The artifact name to use") String name, @Descriptor("The
(placeholder) property names") String[] propertyNames) throws Exception {
+        URL url = generateMetaTypeArtifact(name, propertyNames);
         return url.toExternalForm();
     }
 
@@ -91,12 +91,21 @@ public class TestDataCommands {
         }
     }
 
-    public static URL generateMetaTypeArtifact(String[] propertyNames) throws Exception {
+    public static URL generateMetaTypeArtifact(String name, String[] propertyNames) throws
Exception {
         if (propertyNames == null || propertyNames.length < 1) {
             throw new IllegalArgumentException("Need at least one property name!");
         }
 
-        File dataFile = File.createTempFile("config", ".xml");
+        File dataFile;
+        if (name == null) {
+            dataFile = File.createTempFile("config", ".xml");
+        }
+        else {
+            if (!name.endsWith(".xml")) {
+                name = name.concat(".xml");
+            }
+            dataFile = new File(System.getProperty("java.io.tmpdir"), name);
+        }
         dataFile.deleteOnExit();
 
         XMLOutputFactory factory = XMLOutputFactory.newInstance();

Added: ace/trunk/run-server-allinone/scripts/clear.gogo
URL: http://svn.apache.org/viewvc/ace/trunk/run-server-allinone/scripts/clear.gogo?rev=1572111&view=auto
==============================================================================
--- ace/trunk/run-server-allinone/scripts/clear.gogo (added)
+++ ace/trunk/run-server-allinone/scripts/clear.gogo Wed Feb 26 15:55:35 2014
@@ -0,0 +1,29 @@
+#
+# Clears a complete workspace, removing all the artifacts it finds. Does not
+# attempt to delete anything from an OBR, just all the metadata in ACE.
+#
+
+# install test bundle with additional Gogo commands needed later on in this script
+pwd = (cd) getAbsolutePath
+start 'file:'$pwd'/../org.apache.ace.test/generated/org.apache.ace.test.jar'
+
+
+# create a workspace
+w = (cw)
+
+# delete contents of workspace
+each ($w la) {$w da $it}
+each ($w lf) {$w df $it}
+each ($w ld) {$w dd $it}
+each ($w lt) {$w dt $it}
+each ($w la2f) {$w da2f $it}
+each ($w lf2d) {$w df2d $it}
+each ($w ld2t) {$w dd2t $it}
+
+# delete artifacts from OBR as well (assuming local OBR is used!)...
+r = (repo OBR 'http://localhost:8080/obr/repository.xml')
+repo:rm $r
+
+# commit and delete the workspace
+$w commit
+rw $w

Added: ace/trunk/run-server-allinone/scripts/setup.gogo
URL: http://svn.apache.org/viewvc/ace/trunk/run-server-allinone/scripts/setup.gogo?rev=1572111&view=auto
==============================================================================
--- ace/trunk/run-server-allinone/scripts/setup.gogo (added)
+++ ace/trunk/run-server-allinone/scripts/setup.gogo Wed Feb 26 15:55:35 2014
@@ -0,0 +1,34 @@
+#
+# Sets up a workspace with a collection of entities for testing.
+#
+
+# install test bundle with additional Gogo commands needed later on in this script
+pwd = (cd) getAbsolutePath
+start 'file:'$pwd'/../org.apache.ace.test/generated/org.apache.ace.test.jar'
+
+# create a workspace
+w = (cw)
+
+# create entities in workspace
+each [0 1 2 3 4 5 6 7 8 9] {
+	a = $it
+	each [0 1 2 3 4 5 6 7 8] {
+		echo 'Creating bundle artifact-'$a$it' ...'
+		# generate artifacts and associate them
+        $w ca (gba 'artifact-'$a$it) true
+		$w ca2f '(bundle-symbolicname=artifact-'$a$it')' '(name=feature-'$a')'
+	}
+	echo 'Creating config-'$a'.xml ...'
+	c = (gca 'config-'$a 'common' 'prop'$a'1' 'prop'$a'2' 'prop'$a'3')
+	$w ca $c true
+	$w ca2f '(artifactName=config-'$a'.xml)' '(name=feature-'$a')'
+	$w cf 'feature-'$it
+	$w cf2d '(name=feature-'$it')' '(name=dist-'$it')'
+	$w cd 'dist-'$it
+	$w cd2t '(name=dist-'$it')' '(id=target-'$it')'
+	$w ct 'target-'$it
+}
+
+# commit and delete the workspace
+$w commit
+rw $w



Mime
View raw message