[jboss-svn-commits] JBL Code SVN: r24201 - in labs/jbossrules/trunk/drools-repository/src: test/java/org/drools/repository and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Dec 2 05:25:22 EST 2008
Author: michael.neale at jboss.com
Date: 2008-12-02 05:25:22 -0500 (Tue, 02 Dec 2008)
New Revision: 24201
Modified:
labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/RulesRepository.java
labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/PackageItemTest.java
Log:
JBRULES-1859 incorrect error handling
Modified: labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/RulesRepository.java
===================================================================
--- labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/RulesRepository.java 2008-12-02 10:16:06 UTC (rev 24200)
+++ labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/RulesRepository.java 2008-12-02 10:25:22 UTC (rev 24201)
@@ -516,6 +516,7 @@
/**
* Copies a snapshot to the new location/label.
+ * If one exists at that location, it will be replaced.
*
* @param packageName
* The name of the package.
@@ -533,10 +534,17 @@
Node pkgSnaps = snaps.getNode( packageName );
+
Node sourceNode = pkgSnaps.getNode( snapshotName );
+ if (pkgSnaps.hasNode(newName)) {
+ pkgSnaps.getNode(newName).remove();
+ pkgSnaps.save();
+ }
String destinationPath = pkgSnaps.getPath() + "/" + newName;
+
+
this.session.getWorkspace().copy( sourceNode.getPath(),
destinationPath );
} catch ( RepositoryException e ) {
Modified: labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/PackageItemTest.java
===================================================================
--- labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/PackageItemTest.java 2008-12-02 10:16:06 UTC (rev 24200)
+++ labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/PackageItemTest.java 2008-12-02 10:25:22 UTC (rev 24201)
@@ -27,18 +27,18 @@
assertEquals(prevSize + 1, list.size());
}
-
+
// public void testAddPackageProperties() throws Exception {
// RulesRepository repo = getRepo();
// PackageItem item = repo.createPackage( "testListPackages1", "lalalala" );
//
// assertNotNull(item.getCreator());
-//
+//
// HashMap hash = new HashMap();
// hash.put("Eligibility rules", "Underage");
-//
+//
// String[] testProp = new String[]{"Test1","Test2"};
-//
+//
// item.node.checkout();
// item.node.setProperty("testing", testProp);
// //item.node.setProperty("testing", "blah");
@@ -46,7 +46,7 @@
// String[] newProp = item.getStringPropertyArray( "testing" );
// assertTrue((testProp[0]).equals(newProp[0]));
// assertTrue(("Test2").equals(newProp[1]));
-//
+//
// assertEquals(testProp[0], );
// assertFalse(item.getCreator().equals( "" ));
//
@@ -245,6 +245,13 @@
res = repo.listPackageSnapshots( "testPackageSnapshot" );
assertEquals(2, res.length);
+
+
+ repo.copyPackageSnapshot( "testPackageSnapshot", "BOO", "BOO2" );
+ res = repo.listPackageSnapshots( "testPackageSnapshot" );
+ assertEquals(2, res.length);
+
+
assertEquals("BOO", res[0]);
assertEquals("BOO2", res[1]);
More information about the jboss-svn-commits
mailing list