Search in sources :

Example 1 with ConnectionsRegistry

use of org.jboss.tools.openshift.common.core.connection.ConnectionsRegistry in project jbosstools-openshift by jbosstools.

the class CDKOpenshiftUtilityTest method testOpenshiftConnectionAdded.

@Test
public void testOpenshiftConnectionAdded() throws Exception {
    CDKOpenshiftUtility util = new CDKOpenshiftUtility();
    IServer s = mockServer("openshift33");
    createCDKFile("Basic", null, null);
    ServiceManagerEnvironment adb = createLoader(s);
    ConnectionsRegistry registry = (ConnectionsRegistry) mock(ConnectionsRegistry.class);
    IConnection con = util.createOpenshiftConnection(adb, registry);
    assertNotNull(con);
    verify(registry).add(con);
}
Also used : IServer(org.eclipse.wst.server.core.IServer) ConnectionsRegistry(org.jboss.tools.openshift.common.core.connection.ConnectionsRegistry) CDKOpenshiftUtility(org.jboss.tools.openshift.cdk.server.core.internal.listeners.CDKOpenshiftUtility) ServiceManagerEnvironment(org.jboss.tools.openshift.cdk.server.core.internal.listeners.ServiceManagerEnvironment) IConnection(org.jboss.tools.openshift.common.core.connection.IConnection) Test(org.junit.Test)

Example 2 with ConnectionsRegistry

use of org.jboss.tools.openshift.common.core.connection.ConnectionsRegistry in project jbosstools-openshift by jbosstools.

the class ConnectionRegistryTest method setUp.

@Before
public void setUp() {
    this.registry = new ConnectionsRegistry();
    this.change = new ConnectionsChange(registry);
    this.connection = new OneConnectionImpl("http://localhost:8081");
}
Also used : ConnectionsRegistry(org.jboss.tools.openshift.common.core.connection.ConnectionsRegistry) Before(org.junit.Before)

Example 3 with ConnectionsRegistry

use of org.jboss.tools.openshift.common.core.connection.ConnectionsRegistry in project jbosstools-openshift by jbosstools.

the class OpenShiftProjectCacheTest method setUp.

@Before
public void setUp() throws Exception {
    this.conn = spy(createConnection("spacecat", "42", "https://localhost:8880"));
    doReturn(Arrays.asList(project)).when(conn).getResources(ResourceKind.PROJECT);
    ConnectionsRegistry registry = ConnectionsRegistrySingleton.getInstance();
    registry.clear();
    registry.add(conn);
    this.model = new OpenshiftUIModel(registry) {
    };
    this.connectionWrapper = model.getConnections().iterator().next();
}
Also used : ConnectionsRegistry(org.jboss.tools.openshift.common.core.connection.ConnectionsRegistry) OpenshiftUIModel(org.jboss.tools.openshift.internal.ui.models.OpenshiftUIModel) Before(org.junit.Before)

Example 4 with ConnectionsRegistry

use of org.jboss.tools.openshift.common.core.connection.ConnectionsRegistry in project jbosstools-openshift by jbosstools.

the class CDKOpenshiftUtilityTest method testOpenshiftRegistryDefault.

@Test
public void testOpenshiftRegistryDefault() throws Exception {
    CDKOpenshiftUtility util = new CDKOpenshiftUtility();
    IServer s = mockServer("openshift36");
    createCDKFile("Basic", null, null);
    ServiceManagerEnvironment adb = createLoader(s, "10.1.2.2", "2376", null);
    ConnectionsRegistry registry = (ConnectionsRegistry) mock(ConnectionsRegistry.class);
    IConnection con = util.createOpenshiftConnection(adb, registry);
    assertNotNull(con);
    Object o = ((Connection) con).getExtendedProperties().get(ICommonAttributes.IMAGE_REGISTRY_URL_KEY);
    assertEquals("https://hub.openshift.rhel-cdk.10.1.2.2.xip.io", o);
}
Also used : IServer(org.eclipse.wst.server.core.IServer) ConnectionsRegistry(org.jboss.tools.openshift.common.core.connection.ConnectionsRegistry) CDKOpenshiftUtility(org.jboss.tools.openshift.cdk.server.core.internal.listeners.CDKOpenshiftUtility) ServiceManagerEnvironment(org.jboss.tools.openshift.cdk.server.core.internal.listeners.ServiceManagerEnvironment) IConnection(org.jboss.tools.openshift.common.core.connection.IConnection) Test(org.junit.Test)

Example 5 with ConnectionsRegistry

use of org.jboss.tools.openshift.common.core.connection.ConnectionsRegistry in project jbosstools-openshift by jbosstools.

the class CDKOpenshiftUtilityTest method testOpenshiftRegistry.

@Test
public void testOpenshiftRegistry() throws Exception {
    CDKOpenshiftUtility util = new CDKOpenshiftUtility();
    IServer s = mockServer("openshift35");
    createCDKFile("Basic", null, null);
    ServiceManagerEnvironment adb = createLoader(s, "10.1.2.2", "2376", "https://custom.url");
    ConnectionsRegistry registry = (ConnectionsRegistry) mock(ConnectionsRegistry.class);
    IConnection con = util.createOpenshiftConnection(adb, registry);
    assertNotNull(con);
    Object o = ((Connection) con).getExtendedProperties().get(ICommonAttributes.IMAGE_REGISTRY_URL_KEY);
    assertEquals(o, "https://custom.url");
}
Also used : IServer(org.eclipse.wst.server.core.IServer) ConnectionsRegistry(org.jboss.tools.openshift.common.core.connection.ConnectionsRegistry) CDKOpenshiftUtility(org.jboss.tools.openshift.cdk.server.core.internal.listeners.CDKOpenshiftUtility) ServiceManagerEnvironment(org.jboss.tools.openshift.cdk.server.core.internal.listeners.ServiceManagerEnvironment) IConnection(org.jboss.tools.openshift.common.core.connection.IConnection) Test(org.junit.Test)

Aggregations

ConnectionsRegistry (org.jboss.tools.openshift.common.core.connection.ConnectionsRegistry)6 IServer (org.eclipse.wst.server.core.IServer)3 CDKOpenshiftUtility (org.jboss.tools.openshift.cdk.server.core.internal.listeners.CDKOpenshiftUtility)3 ServiceManagerEnvironment (org.jboss.tools.openshift.cdk.server.core.internal.listeners.ServiceManagerEnvironment)3 IConnection (org.jboss.tools.openshift.common.core.connection.IConnection)3 Before (org.junit.Before)3 Test (org.junit.Test)3 IOpenShiftConnection (org.jboss.tools.openshift.core.connection.IOpenShiftConnection)1 IElementListener (org.jboss.tools.openshift.internal.ui.models.IElementListener)1 OpenshiftUIModel (org.jboss.tools.openshift.internal.ui.models.OpenshiftUIModel)1