use of org.eclipse.che.workspace.infrastructure.kubernetes.wsplugins.brokerphases.BrokerEnvironmentFactory.BrokersConfigs in project devspaces-images by redhat-developer.
the class BrokerEnvironmentFactoryTest method testAddsMergeArgToArtifactsBroker.
@Test
public void testAddsMergeArgToArtifactsBroker() throws Exception {
// given
Collection<PluginFQN> pluginFQNs = singletonList(new PluginFQN(null, "id"));
ArgumentCaptor<BrokersConfigs> captor = ArgumentCaptor.forClass(BrokersConfigs.class);
// when
factory.createForArtifactsBroker(pluginFQNs, runtimeId, true);
// then
verify(factory).doCreate(captor.capture());
BrokersConfigs brokersConfigs = captor.getValue();
List<Container> containers = brokersConfigs.pods.values().stream().flatMap(p -> p.getSpec().getContainers().stream()).collect(Collectors.toList());
assertEquals(containers.size(), 1);
Container container = containers.get(0);
assertTrue(container.getArgs().stream().anyMatch(e -> "--merge-plugins".equals(e)));
}
use of org.eclipse.che.workspace.infrastructure.kubernetes.wsplugins.brokerphases.BrokerEnvironmentFactory.BrokersConfigs in project devspaces-images by redhat-developer.
the class BrokerEnvironmentFactoryTest method shouldCreateConfigMapWithPluginFQNsWithMetadataBroker.
@Test
public void shouldCreateConfigMapWithPluginFQNsWithMetadataBroker() throws Exception {
// given
Collection<PluginFQN> pluginFQNs = ImmutableList.of(new PluginFQN(null, "testPublisher/testPlugin1/testver1"), new PluginFQN(new URI("testregistry"), "testPublisher/testPlugin2/testver2"));
ArgumentCaptor<BrokersConfigs> captor = ArgumentCaptor.forClass(BrokersConfigs.class);
// when
factory.createForMetadataBroker(pluginFQNs, runtimeId, false);
// then
verify(factory).doCreate(captor.capture());
BrokersConfigs brokersConfigs = captor.getValue();
ConfigMap brokerConfigMap = brokersConfigs.configMaps.values().iterator().next();
String config = brokerConfigMap.getData().get(BrokerEnvironmentFactory.CONFIG_FILE);
assertFalse(config.contains("\"registry\":null"), "Should not serialize null registry");
List<String> expected = ImmutableList.of("\"id\":\"testPublisher/testPlugin1/testver1\"", "\"registry\":\"testregistry\"", "\"id\":\"testPublisher/testPlugin2/testver2\"");
for (String expect : expected) {
assertTrue(config.contains(expect), String.format("Missing field from serialized config: expected '%s' in '%s'", expect, config));
}
}
Aggregations