Search in sources :

Example 1 with CustomMacro

use of org.eclipse.che.ide.macro.CustomMacro in project che by eclipse.

the class ServerHostNameMacroTest method getMacros.

@Test
public void getMacros() throws Exception {
    final Set<Macro> providers = provider.getMacros(devMachine);
    assertEquals(providers.size(), 2);
    final Iterator<Macro> iterator = providers.iterator();
    final Macro provider1 = iterator.next();
    assertTrue(provider1 instanceof CustomMacro);
    assertEquals(provider1.getName(), ServerHostNameMacro.KEY.replace("%", WS_AGENT_PORT));
    provider1.expand().then(new Operation<String>() {

        @Override
        public void apply(String address) throws OperationException {
            assertEquals(address, PROTOCOL);
        }
    });
    final Macro provider2 = iterator.next();
    assertTrue(provider2 instanceof CustomMacro);
    assertEquals(provider2.getName(), ServerHostNameMacro.KEY.replace("%", WS_AGENT_PORT.substring(0, WS_AGENT_PORT.length() - 4)));
    provider2.expand().then(new Operation<String>() {

        @Override
        public void apply(String address) throws OperationException {
            assertEquals(address, PROTOCOL);
        }
    });
}
Also used : CustomMacro(org.eclipse.che.ide.macro.CustomMacro) ServerHostNameMacro(org.eclipse.che.ide.macro.ServerHostNameMacro) Macro(org.eclipse.che.ide.api.macro.Macro) CustomMacro(org.eclipse.che.ide.macro.CustomMacro) OperationException(org.eclipse.che.api.promises.client.OperationException) Test(org.junit.Test)

Example 2 with CustomMacro

use of org.eclipse.che.ide.macro.CustomMacro in project che by eclipse.

the class ServerProtocolMacroTest method getMacros.

@Test
public void getMacros() throws Exception {
    final Set<Macro> providers = provider.getMacros(devMachine);
    assertEquals(providers.size(), 2);
    final Iterator<Macro> iterator = providers.iterator();
    final Macro provider1 = iterator.next();
    assertTrue(provider1 instanceof CustomMacro);
    assertEquals(provider1.getName(), ServerProtocolMacro.KEY.replace("%", WS_AGENT_PORT));
    provider1.expand().then(new Operation<String>() {

        @Override
        public void apply(String address) throws OperationException {
            assertEquals(address, PROTOCOL);
        }
    });
    final Macro provider2 = iterator.next();
    assertTrue(provider2 instanceof CustomMacro);
    assertEquals(provider2.getName(), ServerProtocolMacro.KEY.replace("%", WS_AGENT_PORT.substring(0, WS_AGENT_PORT.length() - 4)));
    provider2.expand().then(new Operation<String>() {

        @Override
        public void apply(String address) throws OperationException {
            assertEquals(address, PROTOCOL);
        }
    });
}
Also used : ServerProtocolMacro(org.eclipse.che.ide.macro.ServerProtocolMacro) CustomMacro(org.eclipse.che.ide.macro.CustomMacro) Macro(org.eclipse.che.ide.api.macro.Macro) CustomMacro(org.eclipse.che.ide.macro.CustomMacro) OperationException(org.eclipse.che.api.promises.client.OperationException) Test(org.junit.Test)

Example 3 with CustomMacro

use of org.eclipse.che.ide.macro.CustomMacro in project che by eclipse.

the class ServerMacroTest method getMacros.

@Test
public void getMacros() throws Exception {
    final Set<Macro> providers = provider.getMacros(devMachine);
    assertEquals(providers.size(), 2);
    final Iterator<Macro> iterator = providers.iterator();
    final Macro provider1 = iterator.next();
    assertTrue(provider1 instanceof CustomMacro);
    assertEquals(provider1.getName(), ServerMacro.KEY.replace("%", WS_AGENT_PORT.substring(0, WS_AGENT_PORT.length() - 4)));
    provider1.expand().then(new Operation<String>() {

        @Override
        public void apply(String address) throws OperationException {
            assertEquals(address, ADDRESS);
        }
    });
    final Macro provider2 = iterator.next();
    assertTrue(provider2 instanceof CustomMacro);
    assertEquals(provider2.getName(), ServerMacro.KEY.replace("%", WS_AGENT_PORT));
    provider2.expand().then(new Operation<String>() {

        @Override
        public void apply(String address) throws OperationException {
            assertEquals(address, ADDRESS);
        }
    });
}
Also used : CustomMacro(org.eclipse.che.ide.macro.CustomMacro) Macro(org.eclipse.che.ide.api.macro.Macro) ServerMacro(org.eclipse.che.ide.macro.ServerMacro) CustomMacro(org.eclipse.che.ide.macro.CustomMacro) OperationException(org.eclipse.che.api.promises.client.OperationException) Test(org.junit.Test)

Example 4 with CustomMacro

use of org.eclipse.che.ide.macro.CustomMacro in project che by eclipse.

the class ServerPortMacroTest method getMacros.

@Test
public void getMacros() throws Exception {
    final Set<Macro> providers = provider.getMacros(devMachine);
    assertEquals(providers.size(), 2);
    final Iterator<Macro> iterator = providers.iterator();
    final Macro provider1 = iterator.next();
    assertTrue(provider1 instanceof CustomMacro);
    assertEquals(provider1.getName(), ServerPortMacro.KEY.replace("%", WS_AGENT_PORT.substring(0, WS_AGENT_PORT.length() - 4)));
    provider1.expand().then(new Operation<String>() {

        @Override
        public void apply(String address) throws OperationException {
            assertEquals(address, PORT);
        }
    });
    final Macro provider2 = iterator.next();
    assertTrue(provider2 instanceof CustomMacro);
    assertEquals(provider2.getName(), ServerPortMacro.KEY.replace("%", WS_AGENT_PORT));
    provider2.expand().then(new Operation<String>() {

        @Override
        public void apply(String address) throws OperationException {
            assertEquals(address, PORT);
        }
    });
}
Also used : ServerPortMacro(org.eclipse.che.ide.macro.ServerPortMacro) CustomMacro(org.eclipse.che.ide.macro.CustomMacro) Macro(org.eclipse.che.ide.api.macro.Macro) CustomMacro(org.eclipse.che.ide.macro.CustomMacro) OperationException(org.eclipse.che.api.promises.client.OperationException) Test(org.junit.Test)

Aggregations

OperationException (org.eclipse.che.api.promises.client.OperationException)4 Macro (org.eclipse.che.ide.api.macro.Macro)4 CustomMacro (org.eclipse.che.ide.macro.CustomMacro)4 Test (org.junit.Test)4 ServerHostNameMacro (org.eclipse.che.ide.macro.ServerHostNameMacro)1 ServerMacro (org.eclipse.che.ide.macro.ServerMacro)1 ServerPortMacro (org.eclipse.che.ide.macro.ServerPortMacro)1 ServerProtocolMacro (org.eclipse.che.ide.macro.ServerProtocolMacro)1