Search in sources :

Example 6 with ServerConf2Impl

use of org.eclipse.che.api.workspace.server.model.impl.ServerConf2Impl in project che by eclipse.

the class FactoryServiceTest method createEnvDto.

private static EnvironmentDto createEnvDto() {
    final EnvironmentRecipeImpl environmentRecipe = new EnvironmentRecipeImpl();
    environmentRecipe.setType("type");
    environmentRecipe.setContent("content");
    environmentRecipe.setContentType("compose");
    environmentRecipe.setLocation("location");
    final EnvironmentImpl env = new EnvironmentImpl();
    final ExtendedMachineImpl extendedMachine = new ExtendedMachineImpl();
    extendedMachine.setAgents(singletonList("agent"));
    extendedMachine.setAttributes(singletonMap("att1", "value"));
    extendedMachine.setServers(singletonMap("agent", new ServerConf2Impl("5555", "https", singletonMap("prop1", "value1"))));
    env.setRecipe(environmentRecipe);
    env.setMachines(singletonMap("machine1", extendedMachine));
    return org.eclipse.che.api.workspace.server.DtoConverter.asDto(env);
}
Also used : ServerConf2Impl(org.eclipse.che.api.workspace.server.model.impl.ServerConf2Impl) ExtendedMachineImpl(org.eclipse.che.api.workspace.server.model.impl.ExtendedMachineImpl) EnvironmentImpl(org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl) EnvironmentRecipeImpl(org.eclipse.che.api.workspace.server.model.impl.EnvironmentRecipeImpl)

Example 7 with ServerConf2Impl

use of org.eclipse.che.api.workspace.server.model.impl.ServerConf2Impl in project che by eclipse.

the class CheEnvironmentValidatorTest method createEnv.

private static EnvironmentDto createEnv() {
    // singletonMap, asList are wrapped into modifiable collections to ease env modifying by tests
    EnvironmentImpl env = new EnvironmentImpl();
    Map<String, ExtendedMachineImpl> machines = new HashMap<>();
    Map<String, ServerConf2Impl> servers = new HashMap<>();
    servers.put("ref1", new ServerConf2Impl("8080/tcp", "proto1", singletonMap("prop1", "propValue")));
    servers.put("ref2", new ServerConf2Impl("8080/udp", "proto1", null));
    servers.put("ref3", new ServerConf2Impl("9090", "proto1", null));
    machines.put("dev-machine", new ExtendedMachineImpl(asList("org.eclipse.che.ws-agent", "someAgent"), servers, singletonMap("memoryLimitBytes", "10000")));
    machines.put("machine2", new ExtendedMachineImpl(asList("someAgent2", "someAgent3"), null, singletonMap("memoryLimitBytes", "10000")));
    env.setRecipe(new EnvironmentRecipeImpl("compose", "application/x-yaml", "content", null));
    env.setMachines(machines);
    return DtoConverter.asDto(env);
}
Also used : ServerConf2Impl(org.eclipse.che.api.workspace.server.model.impl.ServerConf2Impl) HashMap(java.util.HashMap) ExtendedMachineImpl(org.eclipse.che.api.workspace.server.model.impl.ExtendedMachineImpl) EnvironmentImpl(org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl) CheServicesEnvironmentImpl(org.eclipse.che.api.environment.server.model.CheServicesEnvironmentImpl) EnvironmentRecipeImpl(org.eclipse.che.api.workspace.server.model.impl.EnvironmentRecipeImpl)

Example 8 with ServerConf2Impl

use of org.eclipse.che.api.workspace.server.model.impl.ServerConf2Impl 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()][]);
}
Also used : Listeners(org.testng.annotations.Listeners) EnvironmentImpl(org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl) DataProvider(org.testng.annotations.DataProvider) Mock(org.mockito.Mock) SERVER_CONF_LABEL_PATH_SUFFIX(org.eclipse.che.api.environment.server.EnvironmentParser.SERVER_CONF_LABEL_PATH_SUFFIX) Assert.assertEquals(org.testng.Assert.assertEquals) Test(org.testng.annotations.Test) HashMap(java.util.HashMap) ExtendedMachineImpl(org.eclipse.che.api.workspace.server.model.impl.ExtendedMachineImpl) ServerConf2Impl(org.eclipse.che.api.workspace.server.model.impl.ServerConf2Impl) CheServicesEnvironmentImpl(org.eclipse.che.api.environment.server.model.CheServicesEnvironmentImpl) ArrayList(java.util.ArrayList) Collections.singletonList(java.util.Collections.singletonList) Arrays.asList(java.util.Arrays.asList) Map(java.util.Map) CheServiceBuildContextImpl(org.eclipse.che.api.environment.server.model.CheServiceBuildContextImpl) Collections.singletonMap(java.util.Collections.singletonMap) Collections.emptyMap(java.util.Collections.emptyMap) SERVER_CONF_LABEL_PROTOCOL_SUFFIX(org.eclipse.che.api.environment.server.EnvironmentParser.SERVER_CONF_LABEL_PROTOCOL_SUFFIX) EnvironmentRecipeImpl(org.eclipse.che.api.workspace.server.model.impl.EnvironmentRecipeImpl) MockitoTestNGListener(org.mockito.testng.MockitoTestNGListener) ImmutableMap(com.google.common.collect.ImmutableMap) Collections.emptyList(java.util.Collections.emptyList) BeforeMethod(org.testng.annotations.BeforeMethod) Set(java.util.Set) Mockito.when(org.mockito.Mockito.when) Assert.assertNotNull(org.testng.Assert.assertNotNull) String.format(java.lang.String.format) Mockito.verify(org.mockito.Mockito.verify) Matchers.any(org.mockito.Matchers.any) List(java.util.List) SERVER_CONF_LABEL_PREFIX(org.eclipse.che.api.environment.server.EnvironmentParser.SERVER_CONF_LABEL_PREFIX) SERVER_CONF_LABEL_REF_SUFFIX(org.eclipse.che.api.environment.server.EnvironmentParser.SERVER_CONF_LABEL_REF_SUFFIX) Environment(org.eclipse.che.api.core.model.workspace.Environment) ServerException(org.eclipse.che.api.core.ServerException) CheServiceImpl(org.eclipse.che.api.environment.server.model.CheServiceImpl) Assert.assertEqualsNoOrder(org.testng.Assert.assertEqualsNoOrder) ServerConf2Impl(org.eclipse.che.api.workspace.server.model.impl.ServerConf2Impl) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) Collections.singletonList(java.util.Collections.singletonList) Arrays.asList(java.util.Arrays.asList) Collections.emptyList(java.util.Collections.emptyList) List(java.util.List) DataProvider(org.testng.annotations.DataProvider)

Aggregations

EnvironmentImpl (org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl)8 EnvironmentRecipeImpl (org.eclipse.che.api.workspace.server.model.impl.EnvironmentRecipeImpl)8 ExtendedMachineImpl (org.eclipse.che.api.workspace.server.model.impl.ExtendedMachineImpl)8 ServerConf2Impl (org.eclipse.che.api.workspace.server.model.impl.ServerConf2Impl)8 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 CheServicesEnvironmentImpl (org.eclipse.che.api.environment.server.model.CheServicesEnvironmentImpl)3 CommandImpl (org.eclipse.che.api.machine.server.model.impl.CommandImpl)3 ProjectConfigImpl (org.eclipse.che.api.workspace.server.model.impl.ProjectConfigImpl)3 SourceStorageImpl (org.eclipse.che.api.workspace.server.model.impl.SourceStorageImpl)3 WorkspaceConfigImpl (org.eclipse.che.api.workspace.server.model.impl.WorkspaceConfigImpl)3 ImmutableMap (com.google.common.collect.ImmutableMap)2 Arrays.asList (java.util.Arrays.asList)2 Collections.singletonList (java.util.Collections.singletonList)2 Collections.singletonMap (java.util.Collections.singletonMap)2 List (java.util.List)2 Map (java.util.Map)2 ServerException (org.eclipse.che.api.core.ServerException)2 Matchers.any (org.mockito.Matchers.any)2 ImmutableList (com.google.common.collect.ImmutableList)1