Search in sources :

Example 1 with MockRegistry

use of aQute.bnd.main.testlib.MockRegistry in project bnd by bndtools.

the class DistroCommandTest method testResolveAgainstDistro.

public void testResolveAgainstDistro() throws Exception {
    bnd bnd = new bnd();
    CommandLine cmdline = new CommandLine(null);
    List<String> remoteArgs = new ArrayList<>();
    RemoteOptions remoteOptions = cmdline.getOptions(RemoteOptions.class, remoteArgs);
    File distro = new File("generated/tmp/test.distro.jar");
    List<String> distroArgs = new ArrayList<>();
    distroArgs.add("-o");
    distroArgs.add(distro.getPath());
    distroArgs.add("test.distro");
    distroArgs.add("1.0.0");
    DistroOptions distroOptions = cmdline.getOptions(DistroOptions.class, distroArgs);
    new RemoteCommand(bnd, remoteOptions)._distro(distroOptions);
    assertTrue(distro.exists());
    ResolveProcess process = new ResolveProcess();
    ResolverLogger logger = new ResolverLogger();
    MockRegistry registry = new MockRegistry();
    Processor model = new Processor();
    model.setProperty("-distro", distro.getAbsolutePath() + ";version=file");
    model.setProperty("-runfw", "org.eclipse.osgi");
    model.setProperty("-runrequires", "osgi.wiring.package;filter:='(osgi.wiring.package=com.liferay.dynamic.data.mapping.taglib.servlet.taglib)'");
    Map<Resource, List<Wire>> requiredResources = process.resolveRequired(model, null, registry, new BndResolver(logger), Collections.<ResolutionCallback>emptyList(), logger);
    assertEquals(1, requiredResources.size());
}
Also used : Processor(aQute.bnd.osgi.Processor) ResolverLogger(biz.aQute.resolve.ResolverLogger) RemoteOptions(aQute.bnd.main.RemoteCommand.RemoteOptions) ArrayList(java.util.ArrayList) MockRegistry(aQute.bnd.main.testlib.MockRegistry) Resource(org.osgi.resource.Resource) CommandLine(aQute.lib.getopt.CommandLine) DistroOptions(aQute.bnd.main.RemoteCommand.DistroOptions) ResolveProcess(biz.aQute.resolve.ResolveProcess) ArrayList(java.util.ArrayList) List(java.util.List) BndResolver(biz.aQute.resolve.BndResolver) File(java.io.File)

Aggregations

DistroOptions (aQute.bnd.main.RemoteCommand.DistroOptions)1 RemoteOptions (aQute.bnd.main.RemoteCommand.RemoteOptions)1 MockRegistry (aQute.bnd.main.testlib.MockRegistry)1 Processor (aQute.bnd.osgi.Processor)1 CommandLine (aQute.lib.getopt.CommandLine)1 BndResolver (biz.aQute.resolve.BndResolver)1 ResolveProcess (biz.aQute.resolve.ResolveProcess)1 ResolverLogger (biz.aQute.resolve.ResolverLogger)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Resource (org.osgi.resource.Resource)1