Feature f101 = repo.getFeatures()[1];
Deployer.DeployCallback callback = EasyMock.createMock(Deployer.DeployCallback.class);
Deployer deployer = new Deployer(manager, callback);
final TestBundle bundleA = createTestBundle(1L, Bundle.ACTIVE, dataDir, "a100");
callback.print(EasyMock.anyString(), EasyMock.anyBoolean());
EasyMock.expectLastCall().anyTimes();
callback.stopBundle(EasyMock.eq(bundleA), anyInt());
EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
@Override
public Object answer() throws Throwable {
bundleA.state = Bundle.RESOLVED;
return null;
}
});
callback.updateBundle(EasyMock.eq(bundleA), EasyMock.<InputStream>anyObject());
EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
@Override
public Object answer() throws Throwable {
URL loc = getClass().getResource(dataDir + "/" + "a101" + ".mf");
Manifest man = new Manifest(loc.openStream());
Hashtable<String, String> headers = new Hashtable<>();
for (Map.Entry attr : man.getMainAttributes().entrySet()) {
headers.put(attr.getKey().toString(), attr.getValue().toString());
}
bundleA.update(headers);
return null;
}
});
callback.startBundle(EasyMock.eq(bundleA));
EasyMock.expectLastCall();