Search in sources :

Example 1 with ServiceManagerEnvironment

use of org.jboss.tools.openshift.cdk.server.core.internal.listeners.ServiceManagerEnvironment 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 ServiceManagerEnvironment

use of org.jboss.tools.openshift.cdk.server.core.internal.listeners.ServiceManagerEnvironment in project jbosstools-openshift by jbosstools.

the class CDKRegistryTest method testRegistryURL.

@Test
public void testRegistryURL() throws Exception {
    ConfigureDependentFrameworksListener configureListener = (ConfigureDependentFrameworksListener) CDKCoreActivator.getDefault().getConfigureDependentFrameworksListener();
    configureListener.disable();
    CredentialService.getCredentialModel().addDomain("redhat.com", "redhat.com", true);
    CredentialService.getCredentialModel().addCredentials(CredentialService.getCredentialModel().getDomain("redhat.com"), "user", "password");
    CDKOpenshiftUtility util = new CDKOpenshiftUtility();
    createCDKFile("Basic", null, null);
    IServer cdkServer = createServer("openshift33");
    ServiceManagerEnvironment adb = createLoader(cdkServer);
    IConnection con = util.createOpenshiftConnection(adb, ConnectionsRegistrySingleton.getInstance());
    assertNotNull(con);
    // Can't test the registry provider model bc it hides the internal details
    CDKRegistryProvider prov = new CDKRegistryProvider() {

        protected ServiceManagerEnvironment getServiceManagerEnvironment(IServer server) {
            try {
                return createLoader(server);
            } catch (Exception e) {
                fail(e.getMessage());
            }
            return null;
        }
    };
    IStatus reg = prov.getRegistryURL(con);
    assertNotNull(reg);
    assertFalse(reg.isOK());
    ControllableServerBehavior beh = (ControllableServerBehavior) cdkServer.loadAdapter(ControllableServerBehavior.class, new NullProgressMonitor());
    beh.setServerStarted();
    reg = prov.getRegistryURL(con);
    assertNotNull(reg);
    assertTrue(reg.isOK());
    configureListener.enable();
    beh.setServerStopped();
}
Also used : CDKRegistryProvider(org.jboss.tools.openshift.cdk.server.core.internal.registry.CDKRegistryProvider) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IServer(org.eclipse.wst.server.core.IServer) IStatus(org.eclipse.core.runtime.IStatus) 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) ControllableServerBehavior(org.jboss.ide.eclipse.as.wtp.core.server.behavior.ControllableServerBehavior) ConfigureDependentFrameworksListener(org.jboss.tools.openshift.cdk.server.core.internal.listeners.ConfigureDependentFrameworksListener) URISyntaxException(java.net.URISyntaxException) CoreException(org.eclipse.core.runtime.CoreException) IOException(java.io.IOException) Test(org.junit.Test)

Example 3 with ServiceManagerEnvironment

use of org.jboss.tools.openshift.cdk.server.core.internal.listeners.ServiceManagerEnvironment in project jbosstools-openshift by jbosstools.

the class ServiceManagerParsingTest method testServiceManager110Linux.

@Test
public void testServiceManager110Linux() throws Exception {
    String[] lines = serviceManager110Linux();
    HashMap<String, String> map = ServiceManagerUtility.parseLines(lines);
    ServiceManagerEnvironment env = new ServiceManagerEnvironment(map);
    serviceManager110(env, LIN_CERT_PATH);
}
Also used : ServiceManagerEnvironment(org.jboss.tools.openshift.cdk.server.core.internal.listeners.ServiceManagerEnvironment) Test(org.junit.Test)

Example 4 with ServiceManagerEnvironment

use of org.jboss.tools.openshift.cdk.server.core.internal.listeners.ServiceManagerEnvironment in project jbosstools-openshift by jbosstools.

the class ServiceManagerParsingTest method testServiceManager101Win.

@Test
public void testServiceManager101Win() throws Exception {
    String[] lines = serviceManager101Win();
    HashMap<String, String> map = ServiceManagerUtility.parseLines(lines);
    ServiceManagerEnvironment env = new ServiceManagerEnvironment(map);
    serviceManager101(env, WIN_CERT_PATH);
}
Also used : ServiceManagerEnvironment(org.jboss.tools.openshift.cdk.server.core.internal.listeners.ServiceManagerEnvironment) Test(org.junit.Test)

Example 5 with ServiceManagerEnvironment

use of org.jboss.tools.openshift.cdk.server.core.internal.listeners.ServiceManagerEnvironment in project jbosstools-openshift by jbosstools.

the class ServiceManagerParsingTest method testServiceManagerWinSET.

@Test
public void testServiceManagerWinSET() throws Exception {
    String[] lines = serviceManagerWinSET();
    HashMap<String, String> map = ServiceManagerUtility.parseLines(lines);
    ServiceManagerEnvironment env = new ServiceManagerEnvironment(map);
    serviceManager110(env, WIN_CERT_PATH);
}
Also used : ServiceManagerEnvironment(org.jboss.tools.openshift.cdk.server.core.internal.listeners.ServiceManagerEnvironment) Test(org.junit.Test)

Aggregations

ServiceManagerEnvironment (org.jboss.tools.openshift.cdk.server.core.internal.listeners.ServiceManagerEnvironment)16 Test (org.junit.Test)13 IServer (org.eclipse.wst.server.core.IServer)7 CDKOpenshiftUtility (org.jboss.tools.openshift.cdk.server.core.internal.listeners.CDKOpenshiftUtility)6 IConnection (org.jboss.tools.openshift.common.core.connection.IConnection)5 ConnectionsRegistry (org.jboss.tools.openshift.common.core.connection.ConnectionsRegistry)3 IStatus (org.eclipse.core.runtime.IStatus)2 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 CoreException (org.eclipse.core.runtime.CoreException)1 MultiStatus (org.eclipse.core.runtime.MultiStatus)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 Status (org.eclipse.core.runtime.Status)1 IDockerConnection (org.eclipse.linuxtools.docker.core.IDockerConnection)1 ControllableServerBehavior (org.jboss.ide.eclipse.as.wtp.core.server.behavior.ControllableServerBehavior)1 ConfigureDependentFrameworksListener (org.jboss.tools.openshift.cdk.server.core.internal.listeners.ConfigureDependentFrameworksListener)1 ServiceManagerEnvironmentLoader (org.jboss.tools.openshift.cdk.server.core.internal.listeners.ServiceManagerEnvironmentLoader)1 CDKRegistryProvider (org.jboss.tools.openshift.cdk.server.core.internal.registry.CDKRegistryProvider)1