use of org.eclipse.che.api.workspace.server.wsplugins.model.PluginFQN in project devspaces-images by redhat-developer.
the class BrokerEnvironmentFactoryTest method testMetadataBrokerSelfSignedCertificate.
@Test
public void testMetadataBrokerSelfSignedCertificate() throws Exception {
when(certProvisioner.isConfigured()).thenReturn(true);
when(certProvisioner.getCertPath()).thenReturn("/tmp/che/cacert");
// given
Collection<PluginFQN> pluginFQNs = singletonList(new PluginFQN(null, "id"));
ArgumentCaptor<BrokersConfigs> captor = ArgumentCaptor.forClass(BrokersConfigs.class);
// when
factory.createForMetadataBroker(pluginFQNs, runtimeId, false);
// 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);
assertEquals(container.getArgs().toArray(), new String[] { "--push-endpoint", PUSH_ENDPOINT, "--runtime-id", String.format("%s:%s:%s", runtimeId.getWorkspaceId(), runtimeId.getEnvName(), runtimeId.getOwnerId()), "--cacert", "/tmp/che/cacert", "--registry-address", DEFAULT_REGISTRY, "--metas", "/broker-config/config.json" });
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.PluginFQN 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.api.workspace.server.wsplugins.model.PluginFQN 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