Search in sources :

Example 1 with OSGiRepository

use of aQute.bnd.repository.osgi.OSGiRepository in project bnd by bndtools.

the class StandaloneTest method testExtraAttribs.

public void testExtraAttribs() throws Exception {
    File f = IO.getFile("testdata/standalone/attribs.bndrun");
    Run run = Run.createRun(null, f);
    List<Repository> repositories = run.getWorkspace().getPlugins(Repository.class);
    assertEquals(1, repositories.size());
    assertTrue(repositories.get(0) instanceof OSGiRepository);
    OSGiRepository f0 = (OSGiRepository) repositories.get(0);
    assertEquals("foo", f0.getName());
    assertEquals("http://example.org/index.xml", f0.getLocation());
    File cacheDir = IO.getFile(System.getProperty("user.home") + "/.custom_cache_dir");
    assertEquals(cacheDir, f0.getRoot());
}
Also used : OSGiRepository(aQute.bnd.repository.osgi.OSGiRepository) Repository(org.osgi.service.repository.Repository) OSGiRepository(aQute.bnd.repository.osgi.OSGiRepository) Run(aQute.bnd.build.Run) File(java.io.File)

Example 2 with OSGiRepository

use of aQute.bnd.repository.osgi.OSGiRepository in project bnd by bndtools.

the class StandaloneTest method testStandalone.

public void testStandalone() throws Exception {
    File f = IO.getFile("testdata/standalone/simple.bndrun");
    Run run = Run.createRun(null, f);
    List<Repository> repositories = run.getWorkspace().getPlugins(Repository.class);
    assertEquals(1, repositories.size());
    assertTrue(repositories.get(0) instanceof OSGiRepository);
    OSGiRepository f0 = (OSGiRepository) repositories.get(0);
    assertEquals("foo", f0.getName());
    assertEquals("http://example.org/index.xml", f0.getLocation());
}
Also used : OSGiRepository(aQute.bnd.repository.osgi.OSGiRepository) Repository(org.osgi.service.repository.Repository) OSGiRepository(aQute.bnd.repository.osgi.OSGiRepository) Run(aQute.bnd.build.Run) File(java.io.File)

Example 3 with OSGiRepository

use of aQute.bnd.repository.osgi.OSGiRepository in project bnd by bndtools.

the class ProjectResolverTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    ws = Workspace.findWorkspace(IO.getFile("testdata/projectresolver/ws"));
    ws.setTrace(true);
    tmp = IO.getFile("generated/tmp");
    local = IO.getFile("generated/tmp/local");
    IO.delete(tmp);
    local.mkdirs();
    OSGiRepository or = new OSGiRepository();
    or.setRegistry(ws);
    or.setReporter(ws);
    Map<String, String> map = new HashMap<>();
    map.put("locations", "https://raw.githubusercontent.com/osgi/osgi.enroute/v1.0.0/cnf/distro/index.xml");
    map.put("name", "enroute");
    or.setProperties(map);
    fr = new ResourcesRepository();
    add(fr, IO.getFile(home, "jar/com.example.jerome.application.jar"));
    add(fr, IO.getFile(home, "jar/osgi.enroute.base.api.jar"));
    ws.addBasicPlugin(fr);
    ws.addBasicPlugin(or);
    ws.propertiesChanged();
}
Also used : HashMap(java.util.HashMap) OSGiRepository(aQute.bnd.repository.osgi.OSGiRepository) ResourcesRepository(aQute.bnd.osgi.repository.ResourcesRepository)

Example 4 with OSGiRepository

use of aQute.bnd.repository.osgi.OSGiRepository in project bnd by bndtools.

the class StandaloneTest method testMacroExpansion.

public void testMacroExpansion() throws Exception {
    File f = IO.getFile("testdata/standalone/macro.bndrun");
    Run run = Run.createRun(null, f);
    List<Repository> repositories = run.getWorkspace().getPlugins(Repository.class);
    assertEquals(1, repositories.size());
    assertTrue(repositories.get(0) instanceof OSGiRepository);
    OSGiRepository f0 = (OSGiRepository) repositories.get(0);
    assertEquals(System.getProperty("user.name") + " M2", f0.getName());
    File indexFile = IO.getFile(System.getProperty("user.home") + "/.m2/repository/repository.xml");
    assertEquals(indexFile.toURI().toString(), f0.getLocation());
}
Also used : OSGiRepository(aQute.bnd.repository.osgi.OSGiRepository) Repository(org.osgi.service.repository.Repository) OSGiRepository(aQute.bnd.repository.osgi.OSGiRepository) Run(aQute.bnd.build.Run) File(java.io.File)

Example 5 with OSGiRepository

use of aQute.bnd.repository.osgi.OSGiRepository in project bnd by bndtools.

the class StandaloneTest method testRelativeUrl.

public void testRelativeUrl() throws Exception {
    File f = IO.getFile("testdata/standalone/relative_url.bndrun");
    Run run = Run.createRun(null, f);
    List<Repository> repositories = run.getWorkspace().getPlugins(Repository.class);
    assertEquals(2, repositories.size());
    assertTrue(repositories.get(0) instanceof OSGiRepository);
    assertTrue(repositories.get(1) instanceof OSGiRepository);
    OSGiRepository f0 = (OSGiRepository) repositories.get(0);
    assertEquals("repo01", f0.getName());
    String resolvedUrl = IO.getFile("testdata/larger-repo.xml").toURI().toString();
    assertEquals(resolvedUrl, f0.getLocation());
    OSGiRepository f1 = (OSGiRepository) repositories.get(1);
    assertEquals("repo02", f1.getName());
    assertEquals("http://example.org/index2.xml", f1.getLocation());
}
Also used : OSGiRepository(aQute.bnd.repository.osgi.OSGiRepository) Repository(org.osgi.service.repository.Repository) OSGiRepository(aQute.bnd.repository.osgi.OSGiRepository) Run(aQute.bnd.build.Run) File(java.io.File)

Aggregations

OSGiRepository (aQute.bnd.repository.osgi.OSGiRepository)6 Run (aQute.bnd.build.Run)5 File (java.io.File)5 Repository (org.osgi.service.repository.Repository)5 ResourcesRepository (aQute.bnd.osgi.repository.ResourcesRepository)1 HashMap (java.util.HashMap)1