use of aQute.bnd.build.Project in project bnd by bndtools.
the class ProjectTest method testRequireBnd.
/**
* Test require bnd
*/
public void testRequireBnd() throws Exception {
Workspace ws = getWorkspace(IO.getFile("testresources/ws"));
Project top = ws.getProject("p1");
top.setProperty("-resourceonly", "true");
top.setProperty("-includeresource", "a;literal=''");
top.setProperty("-require-bnd", "100000.0");
top.build();
assertTrue(top.check("-require-bnd fails for filter values=\\{version="));
}
use of aQute.bnd.build.Project in project bnd by bndtools.
the class ProjectTest method testWildcardBuildPath.
public void testWildcardBuildPath() throws Exception {
Workspace ws = getWorkspace(IO.getFile("testresources/ws"));
Project project = ws.getProject("repofilter");
assertNotNull(project);
project.setProperty("-buildpath", "lib*");
ArrayList<Container> buildpath = new ArrayList<Container>(project.getBuildpath());
for (int i = 1; i < buildpath.size(); i++) {
Container c = buildpath.get(i);
assertEquals(Container.TYPE.REPO, c.getType());
}
}
use of aQute.bnd.build.Project in project bnd by bndtools.
the class ProjectTest method testRepoMacro2.
/**
* https://github.com/bndtools/bnd/issues/395 Repo macro does not refer to
* anything
*/
public void testRepoMacro2() throws Exception {
Workspace ws = getWorkspace(IO.getFile("testresources/ws"));
Project top = ws.getProject("p2");
top.addClasspath(top.getOutput());
top.setProperty("a", "${repo;org.apache.felix.configadmin;latest}");
System.out.println("a= '" + top.getProperty("a") + "'");
assertTrue(top.getProperty("a").endsWith("org.apache.felix.configadmin/org.apache.felix.configadmin-1.8.8.jar".replace('/', File.separatorChar)));
top.setProperty("a", "${repo;IdoNotExist;latest}");
top.getProperty("a");
assertTrue(top.check("macro refers to an artifact IdoNotExist-latest.*that has an error"));
assertEquals("", top.getProperty("a"));
}
use of aQute.bnd.build.Project in project bnd by bndtools.
the class ProjectTest method testHashVersionWithAlgorithmNotFound.
public void testHashVersionWithAlgorithmNotFound() throws Exception {
Workspace ws = getWorkspace(IO.getFile("testresources/ws-versionhash"));
Project project = ws.getProject("p1");
assertNotNull(project);
project.setProperty("-buildpath", "tmp; version=hash; hash=SHA-1:7fe83bfd5999fa4ef9cec40282d5d67dd0ff3303bac6b8c7b0e8be80a821441c");
ArrayList<Container> buildpath = new ArrayList<Container>(project.getBuildpath());
assertEquals(0, buildpath.size());
}
use of aQute.bnd.build.Project in project bnd by bndtools.
the class ProjectTest method testSetPackageVersion.
public void testSetPackageVersion() throws Exception {
Workspace ws = getWorkspace("testresources/ws");
Project project = ws.getProject("p5");
project.setTrace(true);
Version newVersion = new Version(2, 0, 0);
// Package with no package info
project.setPackageInfo("pkg1", newVersion);
Version version = project.getPackageInfo("pkg1");
assertEquals(newVersion, version);
checkPackageInfoFiles(project, "pkg1", true, false);
// Package with package-info.java containing @Version("1.0.0")
project.setPackageInfo("pkg2", newVersion);
version = project.getPackageInfo("pkg2");
assertEquals(newVersion, version);
checkPackageInfoFiles(project, "pkg2", false, true);
// Package with package-info.java containing
// @aQute.bnd.annotations.Version("1.0.0")
project.setPackageInfo("pkg3", newVersion);
version = project.getPackageInfo("pkg3");
assertEquals(newVersion, version);
checkPackageInfoFiles(project, "pkg3", false, true);
// Package with package-info.java containing
// @aQute.bnd.annotations.Version(value="1.0.0")
project.setPackageInfo("pkg4", newVersion);
version = project.getPackageInfo("pkg4");
assertEquals(newVersion, version);
checkPackageInfoFiles(project, "pkg4", false, true);
// Package with package-info.java containing version + packageinfo
project.setPackageInfo("pkg5", newVersion);
version = project.getPackageInfo("pkg5");
assertEquals(newVersion, version);
checkPackageInfoFiles(project, "pkg5", true, true);
// Package with package-info.java NOT containing version +
// packageinfo
project.setPackageInfo("pkg6", newVersion);
version = project.getPackageInfo("pkg6");
assertEquals(newVersion, version);
checkPackageInfoFiles(project, "pkg6", true, true);
// Package with package-info.java NOT containing version
project.setPackageInfo("pkg7", newVersion);
version = project.getPackageInfo("pkg7");
assertEquals(newVersion, version);
checkPackageInfoFiles(project, "pkg7", true, true);
newVersion = new Version(2, 2, 0);
// Update packageinfo file
project.setPackageInfo("pkg1", newVersion);
version = project.getPackageInfo("pkg1");
assertEquals(newVersion, version);
checkPackageInfoFiles(project, "pkg1", true, false);
}
Aggregations