use of org.killbill.billing.util.nodes.NodeInfo in project killbill by killbill.
the class TestWithFakeKPMPlugin method testPluginInstallMechanism.
@Test(groups = "slow")
public void testPluginInstallMechanism() throws Exception {
final NodeCommand nodeCommand = new NodeCommand() {
@Override
public boolean isSystemCommandType() {
return true;
}
@Override
public String getNodeCommandType() {
return SystemNodeCommandType.INSTALL_PLUGIN.name();
}
@Override
public NodeCommandMetadata getNodeCommandMetadata() {
return new PluginNodeCommandMetadata(NEW_PLUGIN_NAME, NEW_PLUGIN_NAME, NEW_PLUGIN_VERSION, ImmutableList.<NodeCommandProperty>of());
}
};
busHandler.pushExpectedEvent(NextEvent.BROADCAST_SERVICE);
nodesApi.triggerNodeCommand(nodeCommand, false);
assertListenerStatus();
// Exit condition is based on the new config being updated on disk
await().atMost(3, SECONDS).until(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
final Iterable<NodeInfo> rawNodeInfos = nodesApi.getNodesInfo();
final List<NodeInfo> nodeInfos = ImmutableList.<NodeInfo>copyOf(rawNodeInfos);
Assert.assertEquals(nodeInfos.size(), 1);
final NodeInfo nodeInfo = nodeInfos.get(0);
final Iterable<PluginInfo> rawPluginInfos = nodeInfo.getPluginInfo();
final List<PluginInfo> pluginsInfo = ImmutableList.copyOf(rawPluginInfos);
if (pluginsInfo.size() == 1) {
final PluginInfo pluginInfo = pluginsInfo.get(0);
Assert.assertEquals(pluginInfo.getPluginName(), NEW_PLUGIN_NAME);
Assert.assertEquals(pluginInfo.getVersion(), NEW_PLUGIN_VERSION);
}
return pluginsInfo.size() == 1;
}
});
}
Aggregations