use of aQute.bnd.service.RepositoryPlugin.PutResult in project bnd by bndtools.
the class TestMultipleLocalIndexGeneration method testDeployBundle.
public void testDeployBundle() throws Exception {
PutResult r = repo.put(new BufferedInputStream(new FileInputStream("testdata/bundles/name.njbartlett.osgi.emf.minimal-2.6.1.jar")), new RepositoryPlugin.PutOptions());
File deployedFile = new File(r.artifact);
assertEquals(IO.getFile(outputDir, "name.njbartlett.osgi.emf.minimal/name.njbartlett.osgi.emf.minimal-2.6.1.jar").getAbsolutePath(), deployedFile.getAbsolutePath());
File r5IndexFile = IO.getFile(outputDir, "index.xml.gz");
assertTrue(r5IndexFile.exists());
File obrIndexFile = IO.getFile(outputDir, "repository.xml");
assertTrue(obrIndexFile.exists());
AbstractIndexedRepo checkRepo;
File[] files;
checkRepo = createRepoForIndex(r5IndexFile);
files = checkRepo.get("name.njbartlett.osgi.emf.minimal", null);
assertNotNull(files);
assertEquals(1, files.length);
assertEquals(deployedFile.getAbsoluteFile(), files[0]);
checkRepo = createRepoForIndex(obrIndexFile);
files = checkRepo.get("name.njbartlett.osgi.emf.minimal", null);
assertNotNull(files);
assertEquals(1, files.length);
assertEquals(deployedFile.getAbsoluteFile(), files[0]);
}
use of aQute.bnd.service.RepositoryPlugin.PutResult in project bnd by bndtools.
the class TestLocalIndexGeneration method testDeployBundle.
public void testDeployBundle() throws Exception {
PutResult r = repo.put(new BufferedInputStream(new FileInputStream("testdata/bundles/name.njbartlett.osgi.emf.minimal-2.6.1.jar")), new RepositoryPlugin.PutOptions());
File deployedFile = new File(r.artifact);
assertEquals(IO.getFile(outputDir, "name.njbartlett.osgi.emf.minimal/name.njbartlett.osgi.emf.minimal-2.6.1.jar").getAbsolutePath(), deployedFile.getAbsolutePath());
File indexFile = IO.getFile(outputDir, "index.xml");
assertTrue(indexFile.exists());
File indexFileSha = IO.getFile(outputDir, "index.xml.sha");
assertTrue(indexFileSha.exists());
AbstractIndexedRepo repo2 = createRepoForIndex(indexFile);
File[] files = repo2.get("name.njbartlett.osgi.emf.minimal", null);
assertNotNull(files);
assertEquals(1, files.length);
assertEquals(deployedFile.getAbsoluteFile(), files[0]);
}
use of aQute.bnd.service.RepositoryPlugin.PutResult in project bnd by bndtools.
the class TestLocalIndexGeneration method testUncompressedIndexFile.
public void testUncompressedIndexFile() throws Exception {
repo = new LocalIndexedRepo();
config = new HashMap<String, String>();
config.put("local", outputDir.getAbsolutePath());
config.put("type", "R5");
config.put("pretty", "true");
config.put("compressed", "false");
repo.setProperties(config);
repo.setReporter(reporter);
PutResult r = repo.put(new BufferedInputStream(new FileInputStream("testdata/bundles/name.njbartlett.osgi.emf.minimal-2.6.1.jar")), new RepositoryPlugin.PutOptions());
File deployedFile = new File(r.artifact);
File compressedIndexFile = IO.getFile(outputDir, "index.xml.gz");
assertFalse(compressedIndexFile.exists());
File prettyIndexFile = IO.getFile(outputDir, "index.xml");
assertTrue(prettyIndexFile.exists());
try {
GZIPInputStream gzip = new GZIPInputStream(new FileInputStream(prettyIndexFile));
fail("expected opening gzip on index file would fail because it should be uncompressed");
} catch (ZipException ze) {
} finally {
IO.delete(new File(r.artifact));
IO.delete(prettyIndexFile);
}
}
use of aQute.bnd.service.RepositoryPlugin.PutResult in project bnd by bndtools.
the class MavenBndRepoTest method testPutRemoteSnapshot.
public void testPutRemoteSnapshot() throws Exception {
Map<String, String> map = new HashMap<>();
map.put("releaseUrl", null);
map.put("snapshotUrl", fnx.getBaseURI() + "/repo/");
config(map);
File jar = IO.getFile("testresources/snapshot.jar");
try (Processor context = new Processor()) {
context.setProperty("-maven-release", "remote;snapshot=1");
PutOptions put = new PutOptions();
put.context = context;
PutResult r = repo.put(new FileInputStream(jar), put);
assertIsFile(local, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/biz.aQute.bnd.maven-3.2.0-SNAPSHOT.jar");
assertIsFile(local, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/biz.aQute.bnd.maven-3.2.0-SNAPSHOT.pom");
assertIsFile(local, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/biz.aQute.bnd.maven-3.2.0-SNAPSHOT-sources.jar");
assertIsFile(local, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/biz.aQute.bnd.maven-3.2.0-SNAPSHOT-javadoc.jar");
assertIsFile(remote, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/biz.aQute.bnd.maven-3.2.0-19700101.000000-1.pom");
assertIsFile(remote, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/biz.aQute.bnd.maven-3.2.0-19700101.000000-1.jar");
assertIsFile(remote, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/biz.aQute.bnd.maven-3.2.0-19700101.000000-1-sources.jar");
assertIsFile(remote, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/biz.aQute.bnd.maven-3.2.0-19700101.000000-1-javadoc.jar");
assertIsFile(remote, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/maven-metadata.xml");
File f = IO.getFile(remote, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/maven-metadata.xml");
String s = IO.collect(f);
assertTrue(s.contains("3.2.0-19700101.000000"));
}
try (Processor context = new Processor()) {
context.setProperty("-maven-release", "remote;snapshot=10000");
PutOptions put = new PutOptions();
put.context = context;
PutResult r = repo.put(new FileInputStream(jar), put);
assertIsFile(local, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/biz.aQute.bnd.maven-3.2.0-SNAPSHOT.jar");
assertIsFile(local, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/biz.aQute.bnd.maven-3.2.0-SNAPSHOT.pom");
assertIsFile(local, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/biz.aQute.bnd.maven-3.2.0-SNAPSHOT-sources.jar");
assertIsFile(local, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/biz.aQute.bnd.maven-3.2.0-SNAPSHOT-javadoc.jar");
assertIsFile(remote, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/biz.aQute.bnd.maven-3.2.0-19700101.000000-1.pom");
assertIsFile(remote, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/biz.aQute.bnd.maven-3.2.0-19700101.000000-1.jar");
assertIsFile(remote, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/biz.aQute.bnd.maven-3.2.0-19700101.000000-1-sources.jar");
assertIsFile(remote, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/biz.aQute.bnd.maven-3.2.0-19700101.000000-1-javadoc.jar");
assertIsFile(remote, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/maven-metadata.xml");
assertIsFile(remote, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/biz.aQute.bnd.maven-3.2.0-19700101.000010-2.pom");
assertIsFile(remote, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/biz.aQute.bnd.maven-3.2.0-19700101.000010-2.jar");
assertIsFile(remote, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/biz.aQute.bnd.maven-3.2.0-19700101.000010-2-sources.jar");
assertIsFile(remote, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/biz.aQute.bnd.maven-3.2.0-19700101.000010-2-javadoc.jar");
assertIsFile(remote, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/maven-metadata.xml");
File f = IO.getFile(remote, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0-SNAPSHOT/maven-metadata.xml");
String s = IO.collect(f);
assertTrue(s.contains("<value>3.2.0-19700101.000000-1</value>"));
assertTrue(s.contains("<value>3.2.0-19700101.000010-2</value>"));
}
}
use of aQute.bnd.service.RepositoryPlugin.PutResult in project bnd by bndtools.
the class MavenBndRepoTest method testPutReleaseAndThenIndex.
public void testPutReleaseAndThenIndex() throws Exception {
Workspace ws = Workspace.findWorkspace(IO.getFile("testdata/releasews"));
Project p1 = ws.getProject("p1");
Project indexProject = ws.getProject("index");
Map<String, String> map = new HashMap<>();
map.put("releaseUrl", remote.toURI().toString());
config(map);
repo.begin(indexProject);
File jar = IO.getFile("testresources/release.jar");
PutOptions po = new PutOptions();
po.context = p1;
PutResult put = repo.put(new FileInputStream(jar), po);
File demoJar = IO.getFile("testresources/demo.jar");
PutOptions indexPo = new PutOptions();
indexPo.context = indexProject;
put = repo.put(new FileInputStream(demoJar), indexPo);
repo.end(indexProject);
assertTrue(indexProject.check());
assertTrue(IO.getFile(remote, "biz/aQute/bnd/demo/1.0.0/demo-1.0.0-index.xml").isFile());
}
Aggregations