use of org.eclipse.che.api.machine.server.model.impl.ServerConfImpl in project che by eclipse.
the class ServerEvaluationStrategyTest method shouldAddPathCorrectlyWithoutLeadingSlash.
@Test
public void shouldAddPathCorrectlyWithoutLeadingSlash() throws Exception {
// given
prepareStrategyAndContainerInfoMocks();
serverConfs.put("8080", new ServerConfImpl("myserv1", "8080", "http", "some"));
serverConfs.put("9090/udp", new ServerConfImpl("myserv1-tftp", "9090/udp", "tftp", "some/path"));
final HashMap<String, ServerImpl> expectedServers = new HashMap<>();
expectedServers.put("8080/tcp", new ServerImpl("myserv1", "http", DEFAULT_HOSTNAME + ":32100", "http://" + DEFAULT_HOSTNAME + ":32100/some", new ServerPropertiesImpl("some", DEFAULT_HOSTNAME + ":32100", "http://" + DEFAULT_HOSTNAME + ":32100/some")));
expectedServers.put("9090/udp", new ServerImpl("myserv1-tftp", "tftp", DEFAULT_HOSTNAME + ":32101", "tftp://" + DEFAULT_HOSTNAME + ":32101/some/path", new ServerPropertiesImpl("some/path", DEFAULT_HOSTNAME + ":32101", "tftp://" + DEFAULT_HOSTNAME + ":32101/some/path")));
// when
final Map<String, ServerImpl> servers = strategy.getServers(containerInfo, DEFAULT_HOSTNAME, serverConfs);
// then
assertEquals(servers, expectedServers);
}
use of org.eclipse.che.api.machine.server.model.impl.ServerConfImpl in project che by eclipse.
the class ServerEvaluationStrategyTest method shouldAllowToUsePortFromMachineConfigWithoutTransportProtocol.
@Test
public void shouldAllowToUsePortFromMachineConfigWithoutTransportProtocol() throws Exception {
// given
prepareStrategyAndContainerInfoMocks();
serverConfs.put("8080", new ServerConfImpl("myserv1", "8080", "http", "/some"));
serverConfs.put("9090/udp", new ServerConfImpl("myserv1-tftp", "9090/udp", "tftp", "/path"));
final HashMap<String, ServerImpl> expectedServers = new HashMap<>();
expectedServers.put("8080/tcp", new ServerImpl("myserv1", "http", DEFAULT_HOSTNAME + ":32100", "http://" + DEFAULT_HOSTNAME + ":32100/some", new ServerPropertiesImpl("/some", DEFAULT_HOSTNAME + ":32100", "http://" + DEFAULT_HOSTNAME + ":32100/some")));
expectedServers.put("9090/udp", new ServerImpl("myserv1-tftp", "tftp", DEFAULT_HOSTNAME + ":32101", "tftp://" + DEFAULT_HOSTNAME + ":32101/path", new ServerPropertiesImpl("/path", DEFAULT_HOSTNAME + ":32101", "tftp://" + DEFAULT_HOSTNAME + ":32101/path")));
// when
final Map<String, ServerImpl> servers = strategy.getServers(containerInfo, DEFAULT_HOSTNAME, serverConfs);
// then
assertEquals(servers, expectedServers);
}
Aggregations