Author: bramk
Date: Tue Jun 25 16:44:14 2013
New Revision: 1496534
URL: http://svn.apache.org/r1496534
Log:
[sandbox] Removed custom repo as IO issues are worked around
Removed:
ace/sandbox/bramk/org.apache.ace.cli/test/org/apache/ace/cli/deployment/CustomLocalIndexRepo.java
Modified:
ace/sandbox/bramk/org.apache.ace.cli/test/org/apache/ace/cli/deployment/ContinuousDeployerTest.java
Modified:
ace/sandbox/bramk/org.apache.ace.cli/test/org/apache/ace/cli/deployment/ContinuousDeployerTest.java
URL:
http://svn.apache.org/viewvc/ace/sandbox/bramk/org.apache.ace.cli/test/org/apache/ace/cli/deployment/ContinuousDeployerTest.java?rev=1496534&r1=1496533&r2=1496534&view=diff
==============================================================================
---
ace/sandbox/bramk/org.apache.ace.cli/test/org/apache/ace/cli/deployment/ContinuousDeployerTest.java
(original)
+++
ace/sandbox/bramk/org.apache.ace.cli/test/org/apache/ace/cli/deployment/ContinuousDeployerTest.java
Tue Jun 25 16:44:14 2013
@@ -20,9 +20,9 @@ import aQute.bnd.osgi.Jar;
public class ContinuousDeployerTest extends TestCase {
File m_workDir;
- CustomLocalIndexRepo m_developmentRepo;
- CustomLocalIndexRepo m_releaseRepo;
- CustomLocalIndexRepo m_deploymentRepo;
+ LocalIndexedRepo m_developmentRepo;
+ LocalIndexedRepo m_releaseRepo;
+ LocalIndexedRepo m_deploymentRepo;
ContinuousDeployer m_deployer;
public void setUp() throws Exception {
@@ -68,28 +68,29 @@ public class ContinuousDeployerTest exte
assertEquals(1, findResources(m_deploymentRepo, "foo.bar",
"0.0.0.CDS001").size());
}
-// FIXME fails
-//
-// public void testSnapshotTakesCorrectBaseVersion() throws Exception {
-//
-// // an initial unreleased bundle from development
-// deployBundle(m_developmentRepo, createBundle("foo.bar", "1.0.0",
Constants.BUNDLE_COPYRIGHT, "Bundle 1.0"));
-// deployBundle(m_developmentRepo, createBundle("foo.bar", "2.0.0",
Constants.BUNDLE_COPYRIGHT, "Bundle 2.0"));
-// copyResources(m_developmentRepo, m_releaseRepo, "foo.bar");
-// m_deployer.deployResources();
-//
-// deployBundle(m_developmentRepo, createBundle("foo.bar", "1.0.1",
Constants.BUNDLE_COPYRIGHT, "Bundle 1.0.1"));
-// m_deployer.deployResources();
-//
-// // should have receive the correct snapshot version
-// assertEquals(1, findResources(m_deploymentRepo, "foo.bar",
"1.0.0.CDS000").size());
-//
-// deployBundle(m_developmentRepo, createBundle("foo.bar", "2.1.0",
Constants.BUNDLE_COPYRIGHT, "Bundle 2.1.0"));
-// m_deployer.deployResources();
-//
-// // should have receive the correct snapshot version
-// assertEquals(1, findResources(m_deploymentRepo, "foo.bar",
"2.0.0.CDS000").size());
-// }
+ public void testSnapshotTakesCorrectBaseVersion() throws Exception {
+
+ // an initial unreleased bundles from development
+ deployBundle(m_developmentRepo, createBundle("foo.bar", "1.0.0",
Constants.BUNDLE_COPYRIGHT, "Bundle 1.0"));
+ deployBundle(m_developmentRepo, createBundle("foo.bar", "2.0.0",
Constants.BUNDLE_COPYRIGHT, "Bundle 2.0"));
+
+ // simulate a release
+ copyResources(m_developmentRepo, m_releaseRepo, "foo.bar");
+
+ m_deployer.deployResources();
+
+ deployBundle(m_developmentRepo, createBundle("foo.bar", "1.0.1",
Constants.BUNDLE_COPYRIGHT, "Bundle 1.0.1"));
+ m_deployer.deployResources();
+
+ // should have receive the correct snapshot version
+ assertEquals(1, findResources(m_deploymentRepo, "foo.bar",
"1.0.0.CDS000").size());
+
+ deployBundle(m_developmentRepo, createBundle("foo.bar", "2.1.0",
Constants.BUNDLE_COPYRIGHT, "Bundle 2.1.0"));
+ m_deployer.deployResources();
+
+ // should have receive the correct snapshot version
+ assertEquals(1, findResources(m_deploymentRepo, "foo.bar",
"2.0.0.CDS000").size());
+ }
public void testInitialSnapshotThenReleaseDeployment() throws Exception {
@@ -107,19 +108,19 @@ public class ContinuousDeployerTest exte
assertEquals(1, findResources(m_deploymentRepo, "foo.bar",
"1.0.0").size());
}
- private CustomLocalIndexRepo createRepo(File root, String name) throws
Exception {
+ private LocalIndexedRepo createRepo(File root, String name) throws
Exception {
if (!(root.exists() || root.mkdir()) || !root.isDirectory())
throw new Exception("Can not access root: " +
root.getAbsolutePath());
Map<String, String> props = new HashMap<String, String>();
props.put(LocalIndexedRepo.PROP_LOCAL_DIR, root.getAbsolutePath());
props.put(LocalIndexedRepo.PROP_PRETTY, "true");
props.put(LocalIndexedRepo.PROP_OVERWRITE, "true");
- CustomLocalIndexRepo repo = new CustomLocalIndexRepo();
+ LocalIndexedRepo repo = new LocalIndexedRepo();
repo.setProperties(props);
return repo;
}
- private void deployBundle(CustomLocalIndexRepo repo, InputStream stream)
throws Exception {
+ private void deployBundle(LocalIndexedRepo repo, InputStream stream)
throws Exception {
try {
repo.put(stream, null);
stream.close();
@@ -129,35 +130,22 @@ public class ContinuousDeployerTest exte
}
}
- private void deployBundle(CustomLocalIndexRepo repo, File file) throws
Exception {
+ private void deployBundle(LocalIndexedRepo repo, File file) throws
Exception {
deployBundle(repo, new FileInputStream(file));
}
- // private void listManifest(File file) throws Exception {
- // JarFile j = new JarFile(file);
- // System.out.println("--------------------------");
- // System.out.println("Manifest for " + file.getAbsolutePath());
- // System.out.println("--------------------------");
- // for (Entry<Object, Object> entry :
j.getManifest().getMainAttributes().entrySet()) {
- // System.out.println(" " + entry.getKey() + ": " + entry.getValue());
- // }
- // j.close();
- // System.out.println("--------------------------");
- //
- // }
-
private File createBundle(final String bsn, final String version, final
String... headers) throws Exception {
- Builder b = new Builder();
+ Builder builder = new Builder();
try {
- b.setBundleSymbolicName(bsn);
- b.setBundleVersion(version);
+ builder.setBundleSymbolicName(bsn);
+ builder.setBundleVersion(version);
for (int i = 0; i < headers.length; i += 2) {
- b.setProperty(headers[i], headers[i + 1]);
+ builder.setProperty(headers[i], headers[i + 1]);
}
- b.setProperty("-noextraheaders", "true");
- Jar jar = b.build();
+ builder.setProperty("-noextraheaders", "true");
+ Jar jar = builder.build();
// add something to work around empty zip file JVM bug
Jar extra = new Jar(new File("generated/org.apache.ace.cli.jar"));
@@ -177,7 +165,7 @@ public class ContinuousDeployerTest exte
throw e;
}
finally {
- b.close();
+ builder.close();
}
}
}