use of org.eclipse.che.api.core.model.workspace.Environment in project che by eclipse.
the class CheEnvironmentValidatorTest method shouldFailIfEnvironmentRecipeFetchingFails.
@Test(expectedExceptions = ServerException.class, expectedExceptionsMessageRegExp = "Parsing of recipe of environment '.*' failed. Error: test exception")
public void shouldFailIfEnvironmentRecipeFetchingFails() throws Exception {
// given
when(environmentParser.parse(any(Environment.class))).thenThrow(new ServerException("test exception"));
// when
environmentValidator.validate("env", environment);
}
use of org.eclipse.che.api.core.model.workspace.Environment in project che by eclipse.
the class CheEnvironmentValidatorTest method invalidServicesEnvironmentProvider.
@DataProvider
public static Object[][] invalidServicesEnvironmentProvider() {
// Format of result array:
// [ [InvalidCheServicesEnvironmentObject, ExceptionMessage], ... ]
CheServicesEnvironmentImpl env;
Map.Entry<String, CheServiceImpl> serviceEntry;
CheServiceImpl service;
List<List<Object>> data = new ArrayList<>();
env = createServicesEnv();
env.setServices(null);
data.add(asList(env, "Environment 'env' should contain at least 1 machine"));
env = createServicesEnv();
env.setServices(emptyMap());
data.add(asList(env, "Environment 'env' should contain at least 1 machine"));
env = createServicesEnv();
serviceEntry = getAnyService(env);
env.getServices().put("invalid service name", serviceEntry.getValue());
data.add(asList(env, "Name of machine 'invalid service name' in environment 'env' is invalid"));
env = createServicesEnv();
serviceEntry = getAnyService(env);
service = serviceEntry.getValue();
service.setImage(null);
service.setBuild(null);
data.add(asList(env, format("Field 'image' or 'build.context' is required in machine '%s' in environment 'env'", serviceEntry.getKey())));
env = createServicesEnv();
serviceEntry = getAnyService(env);
service = serviceEntry.getValue();
service.setImage("");
service.setBuild(null);
data.add(asList(env, format("Field 'image' or 'build.context' is required in machine '%s' in environment 'env'", serviceEntry.getKey())));
env = createServicesEnv();
serviceEntry = getAnyService(env);
service = serviceEntry.getValue();
service.setImage(null);
service.setBuild(new CheServiceBuildContextImpl());
data.add(asList(env, format("Field 'image' or 'build.context' is required in machine '%s' in environment 'env'", serviceEntry.getKey())));
env = createServicesEnv();
serviceEntry = getAnyService(env);
service = serviceEntry.getValue();
service.setImage("");
service.setBuild(new CheServiceBuildContextImpl());
data.add(asList(env, format("Field 'image' or 'build.context' is required in machine '%s' in environment 'env'", serviceEntry.getKey())));
env = createServicesEnv();
serviceEntry = getAnyService(env);
service = serviceEntry.getValue();
service.setPorts(new ArrayList<>(singletonList("8080:8080")));
data.add(asList(env, format("Ports binding is forbidden but found in machine '%s' of environment 'env'", serviceEntry.getKey())));
env = createServicesEnv();
serviceEntry = getAnyService(env);
service = serviceEntry.getValue();
service.setVolumes(new ArrayList<>(singletonList("volume")));
data.add(asList(env, format("Volumes binding is forbidden but found in machine '%s' of environment 'env'", serviceEntry.getKey())));
env = createServicesEnv();
serviceEntry = getAnyService(env);
service = serviceEntry.getValue();
service.setNetworks(new ArrayList<>(singletonList("network1")));
data.add(asList(env, format("Networks configuration is forbidden but found in machine '%s' of environment 'env'", serviceEntry.getKey())));
env = createServicesEnv();
serviceEntry = getAnyService(env);
service = serviceEntry.getValue();
service.setImage(null);
service.setBuild(new CheServiceBuildContextImpl(null, "dockerfile", null, null));
data.add(asList(env, format("Field 'image' or 'build.context' is required in machine '%s' in environment 'env'", serviceEntry.getKey())));
env = createServicesEnv();
serviceEntry = getAnyService(env);
service = serviceEntry.getValue();
service.setImage("");
service.setBuild(new CheServiceBuildContextImpl("", "dockerfile", null, null));
data.add(asList(env, format("Field 'image' or 'build.context' is required in machine '%s' in environment 'env'", serviceEntry.getKey())));
env = createServicesEnv();
serviceEntry = getAnyService(env);
service = serviceEntry.getValue();
service.setImage("");
service.setBuild(new CheServiceBuildContextImpl(null, null, null, null));
data.add(asList(env, format("Field 'image' or 'build.context' is required in machine '%s' in environment 'env'", serviceEntry.getKey())));
env = createServicesEnv();
serviceEntry = getAnyService(env);
service = serviceEntry.getValue();
service.setImage("");
service.setBuild(new CheServiceBuildContextImpl("some url", null, "some content", new HashMap<String, String>() {
{
put("argkey", "argvalue");
}
}));
data.add(asList(env, format("Machine '%s' in environment 'env' contains mutually exclusive dockerfile content and build context.", serviceEntry.getKey())));
return data.stream().map(list -> list.toArray(new Object[list.size()])).toArray(value -> new Object[data.size()][]);
}
use of org.eclipse.che.api.core.model.workspace.Environment in project che by eclipse.
the class CheEnvironmentValidatorTest method shouldNotFailIfExtraMachineDoesNotHaveExtendedMachineEntry.
@Test
public void shouldNotFailIfExtraMachineDoesNotHaveExtendedMachineEntry() throws Exception {
// given
CheServicesEnvironmentImpl cheServicesEnv = createServicesEnv();
cheServicesEnv.getServices().put("extra", createCheService("_extra", 1000000L, null, null, null));
when(environmentParser.parse(any(Environment.class))).thenReturn(cheServicesEnv);
// when
environmentValidator.validate("env", environment);
}
use of org.eclipse.che.api.core.model.workspace.Environment in project che by eclipse.
the class EnvironmentParserTest method shouldAddPortsAndLabelsFromExtendedMachineServers.
@Test(dataProvider = "environmentWithServersProvider")
public void shouldAddPortsAndLabelsFromExtendedMachineServers(EnvironmentImpl environment, CheServicesEnvironmentImpl expectedEnv, CheServicesEnvironmentImpl parsedCheEnv) throws Exception {
when(envParser.parse(any(Environment.class))).thenReturn(parsedCheEnv);
// when
CheServicesEnvironmentImpl cheServicesEnvironment = parser.parse(environment);
// then
// prevent failures because of reordered entries of expose field
assertEquals(cheServicesEnvironment.getServices().size(), expectedEnv.getServices().size());
cheServicesEnvironment.getServices().entrySet().forEach(entry -> {
CheServiceImpl actual = entry.getValue();
CheServiceImpl expected = expectedEnv.getServices().get(entry.getKey());
assertNotNull(expected);
assertEqualsNoOrder(actual.getExpose().toArray(), expected.getExpose().toArray(), format("Expose fields differ. Actual:%s. Expected:%s", actual.getExpose(), expected.getExpose()));
expected.setExpose(null);
actual.setExpose(null);
});
assertEquals(cheServicesEnvironment, expectedEnv);
}
use of org.eclipse.che.api.core.model.workspace.Environment in project che by eclipse.
the class EnvironmentParserTest method environmentWithServersProvider.
@DataProvider(name = "environmentWithServersProvider")
public static Object[][] environmentWithServersProvider() {
// Format of result array:
// [ [environment object, expected che services environment object, @Nullable compose representation of environment], ... ]
List<List<Object>> data = new ArrayList<>();
data.add(getEntryForDockerfileEnv(emptyMap(), emptyList(), emptyMap()));
data.add(getEntryForDockerfileEnv(singletonMap("ref1", new ServerConf2Impl("8080", "http", emptyMap())), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "http", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1")));
data.add(getEntryForDockerfileEnv(singletonMap("ref1", new ServerConf2Impl("8080/tcp", "http", emptyMap())), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "http", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1")));
data.add(getEntryForDockerfileEnv(singletonMap("ref1", new ServerConf2Impl("8080/udp", "http", emptyMap())), singletonList("8080/udp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/udp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "http", SERVER_CONF_LABEL_PREFIX + "8080/udp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1")));
data.add(getEntryForDockerfileEnv(singletonMap("ref1", new ServerConf2Impl("8080", "https", emptyMap())), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1")));
data.add(getEntryForDockerfileEnv(singletonMap("ref1", new ServerConf2Impl("8080", "https", singletonMap("path", "/some/path"))), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "/some/path")));
data.add(getEntryForDockerfileEnv(singletonMap("ref1", new ServerConf2Impl("8080", "https", singletonMap("path", "some/path"))), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "some/path")));
data.add(getEntryForDockerfileEnv(singletonMap("ref1", new ServerConf2Impl("8080", "https", singletonMap("path", ""))), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "")));
data.add(getEntryForDockerfileEnv(singletonMap("ref1", new ServerConf2Impl("8080", "https", singletonMap("path", null))), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1")));
data.add(getEntryForDockerfileEnv(singletonMap("ref1", new ServerConf2Impl("8080", null, emptyMap())), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1")));
data.add(getEntryForDockerfileEnv(singletonMap("ref1", new ServerConf2Impl("8080", "https", splitOnPairsAsMap("some", "value"))), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1")));
data.add(getEntryForDockerfileEnv(singletonMap("ref1", new ServerConf2Impl("8080", "https", splitOnPairsAsMap("some", "value", "path", "some"))), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "some")));
data.add(getEntryForDockerfileEnv(serversMap("ref1", new ServerConf2Impl("8080", "https", singletonMap("path", "some/path")), "ref2", new ServerConf2Impl("9090", "http", singletonMap("path", "/some/path"))), asList("8080/tcp", "9090/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "some/path", SERVER_CONF_LABEL_PREFIX + "9090/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "http", SERVER_CONF_LABEL_PREFIX + "9090/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref2", SERVER_CONF_LABEL_PREFIX + "9090/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "/some/path")));
data.add(getEntryForDockerfileEnv(serversMap("ref1", new ServerConf2Impl("8080", "https", singletonMap("path", "some/path")), "ref2", new ServerConf2Impl("8080/udp", "http", singletonMap("path", "/some/path"))), asList("8080/tcp", "8080/udp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "some/path", SERVER_CONF_LABEL_PREFIX + "8080/udp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "http", SERVER_CONF_LABEL_PREFIX + "8080/udp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref2", SERVER_CONF_LABEL_PREFIX + "8080/udp" + SERVER_CONF_LABEL_PATH_SUFFIX, "/some/path")));
data.add(getEntryForDockerimageEnv(emptyMap(), emptyList(), emptyMap()));
data.add(getEntryForDockerimageEnv(singletonMap("ref1", new ServerConf2Impl("8080", "http", emptyMap())), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "http", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1")));
data.add(getEntryForDockerimageEnv(singletonMap("ref1", new ServerConf2Impl("8080/tcp", "http", emptyMap())), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "http", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1")));
data.add(getEntryForDockerimageEnv(singletonMap("ref1", new ServerConf2Impl("8080/udp", "http", emptyMap())), singletonList("8080/udp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/udp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "http", SERVER_CONF_LABEL_PREFIX + "8080/udp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1")));
data.add(getEntryForDockerimageEnv(singletonMap("ref1", new ServerConf2Impl("8080", "https", emptyMap())), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1")));
data.add(getEntryForDockerimageEnv(singletonMap("ref1", new ServerConf2Impl("8080", "https", singletonMap("path", "/some/path"))), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "/some/path")));
data.add(getEntryForDockerimageEnv(singletonMap("ref1", new ServerConf2Impl("8080", "https", singletonMap("path", "some/path"))), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "some/path")));
data.add(getEntryForDockerimageEnv(singletonMap("ref1", new ServerConf2Impl("8080", "https", singletonMap("path", ""))), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "")));
data.add(getEntryForDockerimageEnv(singletonMap("ref1", new ServerConf2Impl("8080", "https", singletonMap("path", null))), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1")));
data.add(getEntryForDockerimageEnv(singletonMap("ref1", new ServerConf2Impl("8080", null, emptyMap())), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1")));
data.add(getEntryForDockerimageEnv(singletonMap("ref1", new ServerConf2Impl("8080", "https", splitOnPairsAsMap("some", "value"))), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1")));
data.add(getEntryForDockerimageEnv(singletonMap("ref1", new ServerConf2Impl("8080", "https", splitOnPairsAsMap("some", "value", "path", "some"))), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "some")));
data.add(getEntryForDockerimageEnv(serversMap("ref1", new ServerConf2Impl("8080", "https", singletonMap("path", "some/path")), "ref2", new ServerConf2Impl("9090", "http", singletonMap("path", "/some/path"))), asList("8080/tcp", "9090/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "some/path", SERVER_CONF_LABEL_PREFIX + "9090/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "http", SERVER_CONF_LABEL_PREFIX + "9090/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref2", SERVER_CONF_LABEL_PREFIX + "9090/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "/some/path")));
data.add(getEntryForDockerimageEnv(serversMap("ref1", new ServerConf2Impl("8080", "https", singletonMap("path", "some/path")), "ref2", new ServerConf2Impl("8080/udp", "http", singletonMap("path", "/some/path"))), asList("8080/tcp", "8080/udp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "some/path", SERVER_CONF_LABEL_PREFIX + "8080/udp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "http", SERVER_CONF_LABEL_PREFIX + "8080/udp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref2", SERVER_CONF_LABEL_PREFIX + "8080/udp" + SERVER_CONF_LABEL_PATH_SUFFIX, "/some/path")));
data.add(getEntryForComposeEnv(emptyMap(), emptyList(), emptyMap(), emptyList(), emptyMap()));
data.add(getEntryForComposeEnv(singletonMap("ref1", new ServerConf2Impl("8080", "http", emptyMap())), emptyList(), emptyMap(), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "http", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1")));
data.add(getEntryForComposeEnv(singletonMap("ref1", new ServerConf2Impl("8080/tcp", "http", emptyMap())), emptyList(), emptyMap(), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "http", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1")));
data.add(getEntryForComposeEnv(singletonMap("ref1", new ServerConf2Impl("8080/udp", "http", emptyMap())), emptyList(), emptyMap(), singletonList("8080/udp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/udp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "http", SERVER_CONF_LABEL_PREFIX + "8080/udp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1")));
data.add(getEntryForComposeEnv(singletonMap("ref1", new ServerConf2Impl("8080", "https", emptyMap())), emptyList(), emptyMap(), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1")));
data.add(getEntryForComposeEnv(singletonMap("ref1", new ServerConf2Impl("8080", "https", singletonMap("path", "/some/path"))), emptyList(), emptyMap(), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "/some/path")));
data.add(getEntryForComposeEnv(singletonMap("ref1", new ServerConf2Impl("8080", "https", singletonMap("path", "some/path"))), emptyList(), emptyMap(), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "some/path")));
data.add(getEntryForComposeEnv(singletonMap("ref1", new ServerConf2Impl("8080", "https", singletonMap("path", ""))), emptyList(), emptyMap(), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "")));
data.add(getEntryForComposeEnv(singletonMap("ref1", new ServerConf2Impl("8080", "https", singletonMap("path", null))), emptyList(), emptyMap(), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1")));
data.add(getEntryForComposeEnv(singletonMap("ref1", new ServerConf2Impl("8080", null, emptyMap())), emptyList(), emptyMap(), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1")));
data.add(getEntryForComposeEnv(singletonMap("ref1", new ServerConf2Impl("8080", "https", splitOnPairsAsMap("some", "value"))), emptyList(), emptyMap(), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1")));
data.add(getEntryForComposeEnv(singletonMap("ref1", new ServerConf2Impl("8080", "https", splitOnPairsAsMap("some", "value", "path", "some"))), emptyList(), emptyMap(), singletonList("8080/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "some")));
data.add(getEntryForComposeEnv(serversMap("ref1", new ServerConf2Impl("8080", "https", singletonMap("path", "some/path")), "ref2", new ServerConf2Impl("9090", "http", singletonMap("path", "/some/path"))), emptyList(), emptyMap(), asList("8080/tcp", "9090/tcp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "some/path", SERVER_CONF_LABEL_PREFIX + "9090/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "http", SERVER_CONF_LABEL_PREFIX + "9090/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref2", SERVER_CONF_LABEL_PREFIX + "9090/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "/some/path")));
data.add(getEntryForComposeEnv(serversMap("ref1", new ServerConf2Impl("8080", "https", singletonMap("path", "some/path")), "ref2", new ServerConf2Impl("8080/udp", "http", singletonMap("path", "/some/path"))), emptyList(), emptyMap(), asList("8080/tcp", "8080/udp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "some/path", SERVER_CONF_LABEL_PREFIX + "8080/udp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "http", SERVER_CONF_LABEL_PREFIX + "8080/udp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref2", SERVER_CONF_LABEL_PREFIX + "8080/udp" + SERVER_CONF_LABEL_PATH_SUFFIX, "/some/path")));
data.add(getEntryForComposeEnv(serversMap("ref1", new ServerConf2Impl("8080", "https", singletonMap("path", "some/path")), "ref2", new ServerConf2Impl("8080/udp", "http", singletonMap("path", "/some/path"))), asList("9090/tcp", "9090/udp", "7070", "7070/udp"), emptyMap(), asList("8080/tcp", "8080/udp", "9090/udp", "9090/tcp", "7070/tcp", "7070/udp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "some/path", SERVER_CONF_LABEL_PREFIX + "8080/udp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "http", SERVER_CONF_LABEL_PREFIX + "8080/udp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref2", SERVER_CONF_LABEL_PREFIX + "8080/udp" + SERVER_CONF_LABEL_PATH_SUFFIX, "/some/path")));
data.add(getEntryForComposeEnv(serversMap("ref1", new ServerConf2Impl("8080", "https", singletonMap("path", "some/path")), "ref2", new ServerConf2Impl("8080/udp", "http", singletonMap("path", "/some/path"))), emptyList(), splitOnPairsAsMap("label1", "value1", "label2", "value2"), asList("8080/tcp", "8080/udp"), splitOnPairsAsMap(SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "https", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref1", SERVER_CONF_LABEL_PREFIX + "8080/tcp" + SERVER_CONF_LABEL_PATH_SUFFIX, "some/path", SERVER_CONF_LABEL_PREFIX + "8080/udp" + SERVER_CONF_LABEL_PROTOCOL_SUFFIX, "http", SERVER_CONF_LABEL_PREFIX + "8080/udp" + SERVER_CONF_LABEL_REF_SUFFIX, "ref2", SERVER_CONF_LABEL_PREFIX + "8080/udp" + SERVER_CONF_LABEL_PATH_SUFFIX, "/some/path", "label1", "value1", "label2", "value2")));
return data.stream().map(list -> list.toArray(new Object[list.size()])).toArray(value -> new Object[data.size()][]);
}
Aggregations