Search in sources :

Example 16 with DomainSpec

use of oracle.kubernetes.weblogic.domain.v1.DomainSpec in project weblogic-kubernetes-operator by oracle.

the class WlsDomainConfigTest method verifyUpdateDomainSpecReplicasNotValidatedWithMoreThan1Clusters.

@Test
public void verifyUpdateDomainSpecReplicasNotValidatedWithMoreThan1Clusters() throws Exception {
    WlsDomainConfig wlsDomainConfig = WlsDomainConfig.create().load(JSON_STRING_2_CLUSTERS);
    DomainSpec domainSpec = new DomainSpec().withClusterStartup(Arrays.asList(new ClusterStartup().withClusterName("DockerCluster"))).withReplicas(10);
    TestUtil.LogHandlerImpl handler = null;
    WlsClusterConfig wlsClusterConfig = wlsDomainConfig.getClusterConfig("DockerCluster");
    try {
        handler = TestUtil.setupLogHandler(wlsClusterConfig);
        wlsDomainConfig.updateDomainSpecAsNeeded(domainSpec);
        assertFalse(handler.hasWarningMessageLogged());
    } finally {
        TestUtil.removeLogHandler(wlsClusterConfig, handler);
    }
}
Also used : DomainSpec(oracle.kubernetes.weblogic.domain.v1.DomainSpec) ClusterStartup(oracle.kubernetes.weblogic.domain.v1.ClusterStartup) Test(org.junit.Test)

Example 17 with DomainSpec

use of oracle.kubernetes.weblogic.domain.v1.DomainSpec in project weblogic-kubernetes-operator by oracle.

the class WlsDomainConfigTest method verifyUpdateDomainSpecWarnsIfClusterStatupReplicasTooLarge_2clusters.

@Test
public void verifyUpdateDomainSpecWarnsIfClusterStatupReplicasTooLarge_2clusters() throws Exception {
    WlsDomainConfig wlsDomainConfig = WlsDomainConfig.create().load(JSON_STRING_2_CLUSTERS);
    ClusterStartup dockerCluster = new ClusterStartup().withClusterName("DockerCluster").withReplicas(10);
    ClusterStartup dockerCluster2 = new ClusterStartup().withClusterName("DockerCluster2").withReplicas(10);
    DomainSpec domainSpec = new DomainSpec().withClusterStartup(Arrays.asList(dockerCluster, dockerCluster2));
    TestUtil.LogHandlerImpl handler = null;
    WlsClusterConfig wlsClusterConfig = wlsDomainConfig.getClusterConfig("DockerCluster2");
    try {
        handler = TestUtil.setupLogHandler(wlsClusterConfig);
        wlsDomainConfig.updateDomainSpecAsNeeded(domainSpec);
        assertTrue("Message logged: " + handler.getAllFormattedMessage(), handler.hasWarningMessageWithSubString("Replicas in clusterStartup for cluster DockerCluster is specified with a value of 10 which is larger than the number of configured WLS servers in the cluster: 3"));
        assertTrue("Message logged: " + handler.getAllFormattedMessage(), handler.hasWarningMessageWithSubString("Replicas in clusterStartup for cluster DockerCluster2 is specified with a value of 10 which is larger than the number of configured WLS servers in the cluster: 2"));
    } finally {
        TestUtil.removeLogHandler(wlsClusterConfig, handler);
    }
}
Also used : DomainSpec(oracle.kubernetes.weblogic.domain.v1.DomainSpec) ClusterStartup(oracle.kubernetes.weblogic.domain.v1.ClusterStartup) Test(org.junit.Test)

Example 18 with DomainSpec

use of oracle.kubernetes.weblogic.domain.v1.DomainSpec in project weblogic-kubernetes-operator by oracle.

the class WlsDomainConfigTest method verifyUpdateDomainSpecInfoIfReplicasAndTwoClusters.

@Test
public void verifyUpdateDomainSpecInfoIfReplicasAndTwoClusters() throws Exception {
    WlsDomainConfig wlsDomainConfig = WlsDomainConfig.create().load(JSON_STRING_2_CLUSTERS);
    DomainSpec domainSpec = new DomainSpec().withClusterStartup(Arrays.asList(new ClusterStartup().withClusterName("DockerCluster"))).withReplicas(10);
    TestUtil.LogHandlerImpl handler = null;
    try {
        handler = TestUtil.setupLogHandler(wlsDomainConfig);
        wlsDomainConfig.updateDomainSpecAsNeeded(domainSpec);
        assertTrue("Message logged: " + handler.getAllFormattedMessage(), handler.hasInfoMessageWithSubString("Replicas specified in Domain spec is ignored because there number of configured WLS cluster is not 1."));
    } finally {
        TestUtil.removeLogHandler(wlsDomainConfig, handler);
    }
}
Also used : DomainSpec(oracle.kubernetes.weblogic.domain.v1.DomainSpec) ClusterStartup(oracle.kubernetes.weblogic.domain.v1.ClusterStartup) Test(org.junit.Test)

Example 19 with DomainSpec

use of oracle.kubernetes.weblogic.domain.v1.DomainSpec in project weblogic-kubernetes-operator by oracle.

the class WlsDomainConfigTest method verifyUpdateDomainSpecInfoIfReplicasAndZeroClusters.

@Test
public void verifyUpdateDomainSpecInfoIfReplicasAndZeroClusters() throws Exception {
    WlsDomainConfig wlsDomainConfig = WlsDomainConfig.create();
    DomainSpec domainSpec = new DomainSpec().withClusterStartup(Arrays.asList(new ClusterStartup().withClusterName("DockerCluster"))).withReplicas(10);
    TestUtil.LogHandlerImpl handler = null;
    try {
        handler = TestUtil.setupLogHandler(wlsDomainConfig);
        wlsDomainConfig.updateDomainSpecAsNeeded(domainSpec);
        assertTrue("Message logged: " + handler.getAllFormattedMessage(), handler.hasInfoMessageWithSubString("Replicas specified in Domain spec is ignored because there number of configured WLS cluster is not 1."));
    } finally {
        TestUtil.removeLogHandler(wlsDomainConfig, handler);
    }
}
Also used : DomainSpec(oracle.kubernetes.weblogic.domain.v1.DomainSpec) ClusterStartup(oracle.kubernetes.weblogic.domain.v1.ClusterStartup) Test(org.junit.Test)

Aggregations

DomainSpec (oracle.kubernetes.weblogic.domain.v1.DomainSpec)17 ClusterStartup (oracle.kubernetes.weblogic.domain.v1.ClusterStartup)11 Test (org.junit.Test)10 Domain (oracle.kubernetes.weblogic.domain.v1.Domain)6 V1ObjectMeta (io.kubernetes.client.models.V1ObjectMeta)3 V1Service (io.kubernetes.client.models.V1Service)2 ArrayList (java.util.ArrayList)2 DomainPresenceInfo (oracle.kubernetes.operator.helpers.DomainPresenceInfo)2 WlsServerConfig (oracle.kubernetes.operator.wlsconfig.WlsServerConfig)2 Engine (oracle.kubernetes.operator.work.Engine)2 Packet (oracle.kubernetes.operator.work.Packet)2 Step (oracle.kubernetes.operator.work.Step)2 V1ConfigMap (io.kubernetes.client.models.V1ConfigMap)1 V1EnvVar (io.kubernetes.client.models.V1EnvVar)1 V1ServiceList (io.kubernetes.client.models.V1ServiceList)1 V1ServicePort (io.kubernetes.client.models.V1ServicePort)1 V1ServiceSpec (io.kubernetes.client.models.V1ServiceSpec)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1