Search in sources :

Example 1 with OpenShiftProviderConfigImpl

use of org.guvnor.ala.openshift.config.impl.OpenShiftProviderConfigImpl in project kie-wb-common by kiegroup.

the class RuntimeEndpointsTestIT method createProviderConfig.

private OpenShiftProviderConfigImpl createProviderConfig() {
    OpenShiftProviderConfigImpl openshiftProviderConfig = new OpenShiftProviderConfigImpl().clear();
    openshiftProviderConfig.setName(getClass().getSimpleName());
    openshiftProviderConfig.setKubernetesMaster("https://ce-os-rhel-master.usersys.redhat.com:8443");
    openshiftProviderConfig.setKubernetesAuthBasicUsername("admin");
    openshiftProviderConfig.setKubernetesAuthBasicPassword("admin");
    return openshiftProviderConfig;
}
Also used : OpenShiftProviderConfigImpl(org.guvnor.ala.openshift.config.impl.OpenShiftProviderConfigImpl)

Example 2 with OpenShiftProviderConfigImpl

use of org.guvnor.ala.openshift.config.impl.OpenShiftProviderConfigImpl in project kie-wb-common by kiegroup.

the class OpenShiftExecutorTest method testProviderConfigReuse.

/**
 * Make sure we can reuse the provider for two different runtimes.
 * TODO: replace with more lightweight image and non-internal (minishift?) environment.
 * @throws Exception
 */
@Test
public void testProviderConfigReuse() throws Exception {
    OpenShiftProviderConfigImpl providerConfig = new OpenShiftProviderConfigImpl().clear();
    providerConfig.setName(getClass().getSimpleName());
    providerConfig.setKubernetesMaster("https://ce-os-rhel-master.usersys.redhat.com:8443");
    providerConfig.setKubernetesAuthBasicUsername("admin");
    providerConfig.setKubernetesAuthBasicPassword("admin");
    OpenShiftClient client = new OpenShiftAccessInterfaceImpl().newOpenShiftClient(providerConfig);
    OpenShiftRuntimeConfigImpl runtimeConfigA = createRuntimeConfig("tpcr1");
    OpenShiftRuntimeConfigImpl runtimeConfigB = createRuntimeConfig("tpcr2");
    client.create(runtimeConfigA);
    client.create(runtimeConfigB);
    client.destroy(runtimeConfigA.getRuntimeId().toString());
    client.destroy(runtimeConfigB.getRuntimeId().toString());
}
Also used : OpenShiftRuntimeConfigImpl(org.guvnor.ala.openshift.config.impl.OpenShiftRuntimeConfigImpl) OpenShiftAccessInterfaceImpl(org.guvnor.ala.openshift.access.impl.OpenShiftAccessInterfaceImpl) OpenShiftClient(org.guvnor.ala.openshift.access.OpenShiftClient) OpenShiftProviderConfigImpl(org.guvnor.ala.openshift.config.impl.OpenShiftProviderConfigImpl) Test(org.junit.Test)

Example 3 with OpenShiftProviderConfigImpl

use of org.guvnor.ala.openshift.config.impl.OpenShiftProviderConfigImpl in project kie-wb-common by kiegroup.

the class OpenShiftProviderConfigConverter method toDomain.

@Override
public OpenShiftProviderConfig toDomain(ProviderConfiguration modelValue) {
    if (modelValue == null) {
        return null;
    }
    OpenShiftProviderConfigImpl openShiftProviderConfig = new OpenShiftProviderConfigImpl();
    openShiftProviderConfig.clear();
    openShiftProviderConfig.setName(modelValue.getId());
    openShiftProviderConfig.setKubernetesMaster(getStringValue(modelValue.getValues(), KUBERNETES_MASTER.inputKey()));
    openShiftProviderConfig.setKubernetesAuthBasicUsername(getStringValue(modelValue.getValues(), KUBERNETES_AUTH_BASIC_USERNAME.inputKey()));
    openShiftProviderConfig.setKubernetesAuthBasicPassword(getStringValue(modelValue.getValues(), KUBERNETES_AUTH_BASIC_PASSWORD.inputKey()));
    return openShiftProviderConfig;
}
Also used : OpenShiftProviderConfigImpl(org.guvnor.ala.openshift.config.impl.OpenShiftProviderConfigImpl)

Example 4 with OpenShiftProviderConfigImpl

use of org.guvnor.ala.openshift.config.impl.OpenShiftProviderConfigImpl in project kie-wb-common by kiegroup.

the class RuntimeEndpointsTestIT method checkOpenShiftService.

/**
 * Can be used if internal to red hat.
 * TODO: replace with more lightweight image and non-internal (minishift?) environment
 * @throws Exception
 */
@Ignore
public void checkOpenShiftService() throws Exception {
    Client client = ClientBuilder.newClient();
    WebTarget target = client.target(APP_URL);
    ResteasyWebTarget restEasyTarget = (ResteasyWebTarget) target;
    RuntimeProvisioningService proxy = restEasyTarget.proxy(RuntimeProvisioningService.class);
    ProviderTypeList allProviderTypes = proxy.getProviderTypes(0, 10, "", true);
    assertNotNull(allProviderTypes);
    assertEquals(3, allProviderTypes.getItems().size());
    OpenShiftProviderConfigImpl openshiftProviderConfig = createProviderConfig();
    proxy.registerProvider(openshiftProviderConfig);
    ProviderList allProviders = proxy.getProviders(0, 10, "", true);
    assertEquals(1, allProviders.getItems().size());
    assertTrue(allProviders.getItems().get(0) instanceof OpenShiftProvider);
    OpenShiftProvider openshiftProvider = (OpenShiftProvider) allProviders.getItems().get(0);
    OpenShiftRuntimeConfig runtimeConfig = createRuntimeConfig(openshiftProvider, "coss1");
    @SuppressWarnings("unused") OpenShiftRuntime openshiftRuntime = getOpenShiftRuntime(proxy, 0, null);
    String runtimeId = proxy.newRuntime(runtimeConfig);
    openshiftRuntime = getOpenShiftRuntime(proxy, 1, OpenShiftRuntimeState.READY);
    proxy.startRuntime(runtimeId);
    openshiftRuntime = getOpenShiftRuntime(proxy, 1, OpenShiftRuntimeState.RUNNING);
    proxy.stopRuntime(runtimeId);
    openshiftRuntime = getOpenShiftRuntime(proxy, 1, OpenShiftRuntimeState.READY);
    proxy.destroyRuntime(runtimeId, true);
    openshiftRuntime = getOpenShiftRuntime(proxy, 0, null);
}
Also used : ProviderList(org.guvnor.ala.services.api.itemlist.ProviderList) RuntimeProvisioningService(org.guvnor.ala.services.api.RuntimeProvisioningService) OpenShiftRuntime(org.guvnor.ala.openshift.model.OpenShiftRuntime) ResteasyWebTarget(org.jboss.resteasy.client.jaxrs.ResteasyWebTarget) OpenShiftProvider(org.guvnor.ala.openshift.model.OpenShiftProvider) ResteasyWebTarget(org.jboss.resteasy.client.jaxrs.ResteasyWebTarget) WebTarget(javax.ws.rs.client.WebTarget) Client(javax.ws.rs.client.Client) OpenShiftProviderConfigImpl(org.guvnor.ala.openshift.config.impl.OpenShiftProviderConfigImpl) ProviderTypeList(org.guvnor.ala.services.api.itemlist.ProviderTypeList) OpenShiftRuntimeConfig(org.guvnor.ala.openshift.config.OpenShiftRuntimeConfig) Ignore(org.junit.Ignore)

Example 5 with OpenShiftProviderConfigImpl

use of org.guvnor.ala.openshift.config.impl.OpenShiftProviderConfigImpl in project kie-wb-common by kiegroup.

the class OpenShiftAccessTest method testProviderConfig.

@Test
public void testProviderConfig() {
    OpenShiftProviderConfigImpl providerConfig = new OpenShiftProviderConfigImpl().clear();
    providerConfig.setKubernetesMaster("https://localhost:8443");
    providerConfig.setKubernetesOapiVersion("v2");
    OpenShiftConfig clientConfig = OpenShiftAccessInterfaceImpl.buildOpenShiftConfig(providerConfig);
    assertEquals("https://localhost:8443/", clientConfig.getMasterUrl());
    assertEquals("https://localhost:8443/oapi/v2/", clientConfig.getOpenShiftUrl());
}
Also used : OpenShiftConfig(io.fabric8.openshift.client.OpenShiftConfig) OpenShiftProviderConfigImpl(org.guvnor.ala.openshift.config.impl.OpenShiftProviderConfigImpl) Test(org.junit.Test)

Aggregations

OpenShiftProviderConfigImpl (org.guvnor.ala.openshift.config.impl.OpenShiftProviderConfigImpl)5 Test (org.junit.Test)2 OpenShiftConfig (io.fabric8.openshift.client.OpenShiftConfig)1 Client (javax.ws.rs.client.Client)1 WebTarget (javax.ws.rs.client.WebTarget)1 OpenShiftClient (org.guvnor.ala.openshift.access.OpenShiftClient)1 OpenShiftAccessInterfaceImpl (org.guvnor.ala.openshift.access.impl.OpenShiftAccessInterfaceImpl)1 OpenShiftRuntimeConfig (org.guvnor.ala.openshift.config.OpenShiftRuntimeConfig)1 OpenShiftRuntimeConfigImpl (org.guvnor.ala.openshift.config.impl.OpenShiftRuntimeConfigImpl)1 OpenShiftProvider (org.guvnor.ala.openshift.model.OpenShiftProvider)1 OpenShiftRuntime (org.guvnor.ala.openshift.model.OpenShiftRuntime)1 RuntimeProvisioningService (org.guvnor.ala.services.api.RuntimeProvisioningService)1 ProviderList (org.guvnor.ala.services.api.itemlist.ProviderList)1 ProviderTypeList (org.guvnor.ala.services.api.itemlist.ProviderTypeList)1 ResteasyWebTarget (org.jboss.resteasy.client.jaxrs.ResteasyWebTarget)1 Ignore (org.junit.Ignore)1