Skip to content

Commit d5068a7

Browse files
authored
Merge pull request #841 from oracle/develop-OWLS-70602
Develop owls 70602
2 parents fe939d2 + f4e7e31 commit d5068a7

File tree

5 files changed

+89
-3
lines changed

5 files changed

+89
-3
lines changed

integration-tests/pom.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,12 @@
7171
<artifactId>client-java</artifactId>
7272
<scope>test</scope>
7373
</dependency>
74-
</dependencies>
74+
<dependency>
75+
<groupId>javax.jms</groupId>
76+
<artifactId>javax.jms-api</artifactId>
77+
<version>2.0</version>
78+
</dependency>
79+
</dependencies>
7580

7681

7782
<profiles>
@@ -156,6 +161,9 @@
156161
<!--<TAGS>${env.TAGS}</TAGS> -->
157162
<maxThreads>3</maxThreads>
158163
</systemPropertyVariables>
164+
<additionalClasspathElements>
165+
<additionalClasspathElement>${project.basedir}/src/test/resources/wlthint3client.jar</additionalClasspathElement>
166+
</additionalClasspathElements>
159167
</configuration>
160168

161169
<executions>

integration-tests/src/test/java/oracle/kubernetes/operator/BaseTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import java.util.logging.FileHandler;
1212
import java.util.logging.Logger;
1313
import java.util.logging.SimpleFormatter;
14+
import javax.jms.Connection;
15+
import javax.jms.ConnectionFactory;
1416
import oracle.kubernetes.operator.utils.Domain;
1517
import oracle.kubernetes.operator.utils.ExecCommand;
1618
import oracle.kubernetes.operator.utils.ExecResult;
@@ -179,6 +181,23 @@ public void testAdminT3Channel(Domain domain) throws Exception {
179181
logger.info("Done - testAdminT3Channel");
180182
}
181183

184+
/**
185+
* Verify t3channel port by a JMS connection.
186+
*
187+
* @throws Exception
188+
*/
189+
public void testAdminT3ChannelWithJMS(Domain domain) throws Exception {
190+
logger.info("Inside testAdminT3ChannelWithJMS");
191+
ConnectionFactory cf = domain.createJMSConnectionFactory();
192+
Connection c = cf.createConnection();
193+
logger.info("Connection created successfully before cycle.");
194+
domain.shutdownUsingServerStartPolicy();
195+
domain.restartUsingServerStartPolicy();
196+
c = cf.createConnection();
197+
logger.info("Connection created successfully after cycle");
198+
c.close();
199+
logger.info("Done - testAdminT3ChannelWithJMS");
200+
}
182201
/**
183202
* Restarting the domain should not have any impact on Operator managing the domain, web app load
184203
* balancing and node port service

integration-tests/src/test/java/oracle/kubernetes/operator/ITOperator.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@ public void testAutoSitConfigOverrides() throws Exception {
565565
domain11 = testDomainCreation(domain11YamlFile);
566566
domain11.verifyDomainCreated();
567567
testBasicUseCases(domain11);
568+
testAdminT3ChannelWithJMS(domain11);
568569
// testAdvancedUseCasesForADomain(operator1, domain11);
569570
testCompletedSuccessfully = true;
570571

@@ -613,6 +614,7 @@ public void testCustomSitConfigOverrides() throws Exception {
613614
domain12 = testDomainCreation(domain12YamlFile);
614615
domain12.verifyDomainCreated();
615616
testBasicUseCases(domain12);
617+
testAdminT3ChannelWithJMS(domain12);
616618
// testAdvancedUseCasesForADomain(operator1, domain11);
617619
testCompletedSuccessfully = true;
618620

integration-tests/src/test/java/oracle/kubernetes/operator/utils/Domain.java

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@
1212
import java.nio.file.Paths;
1313
import java.nio.file.StandardOpenOption;
1414
import java.util.HashMap;
15+
import java.util.Hashtable;
1516
import java.util.Map;
1617
import java.util.Objects;
1718
import java.util.logging.Logger;
19+
import javax.jms.ConnectionFactory;
20+
import javax.jms.QueueConnection;
21+
import javax.jms.QueueConnectionFactory;
22+
import javax.naming.Context;
23+
import javax.naming.InitialContext;
1824
import oracle.kubernetes.operator.BaseTest;
1925
import org.yaml.snakeyaml.Yaml;
2026

@@ -306,6 +312,26 @@ public void deployWebAppViaWLST(
306312
callShellScriptByExecToPod(username, password, webappName);
307313
}
308314

315+
/**
316+
* Creates a Connection Factory using JMS.
317+
*
318+
* @return connection facotry.
319+
* @throws Exception
320+
*/
321+
public ConnectionFactory createJMSConnectionFactory() throws Exception {
322+
Hashtable<String, String> env = new Hashtable<>();
323+
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
324+
env.put(Context.PROVIDER_URL, "t3://" + TestUtils.getHostName() + ":" + t3ChannelPort);
325+
logger.info("Creating JNDI context with URL " + env.get(Context.PROVIDER_URL));
326+
InitialContext ctx = new InitialContext(env);
327+
QueueConnection qcc = null;
328+
logger.info("Getting JMS Connection Factory");
329+
QueueConnectionFactory cf =
330+
(QueueConnectionFactory) ctx.lookup("weblogic.jms.ConnectionFactory");
331+
logger.info("Connection Factory created successfully");
332+
return cf;
333+
}
334+
309335
/**
310336
* Test http load balancing using loadBalancerWebPort
311337
*
@@ -457,6 +483,28 @@ public void shutdownUsingServerStartPolicy() throws Exception {
457483
verifyServerPodsDeleted(replicas);
458484
}
459485

486+
/**
487+
* restart domain by setting serverStartPolicy to IF_NEEDED
488+
*
489+
* @throws Exception
490+
*/
491+
public void restartUsingServerStartPolicy() throws Exception {
492+
String cmd =
493+
"kubectl patch domain "
494+
+ domainUid
495+
+ " -n "
496+
+ domainNS
497+
+ " -p '{\"spec\":{\"serverStartPolicy\":\"IF_NEEDED\"}}' --type merge";
498+
ExecResult result = ExecCommand.exec(cmd);
499+
if (result.exitValue() != 0) {
500+
throw new RuntimeException(
501+
"FAILURE: command " + cmd + " failed, returned " + result.stderr());
502+
}
503+
String output = result.stdout().trim();
504+
logger.info("command to restart domain " + cmd + " \n returned " + output);
505+
verifyPodsCreated();
506+
verifyServersReady();
507+
}
460508
/**
461509
* verify domain is deleted
462510
*

integration-tests/src/test/resources/setupenv.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ function create_image_pull_secret_jenkins {
9494
fi
9595
}
9696

97+
function get_wlthint3client_from_image {
98+
# Get wlthint3client.jar from image
99+
id=$(docker create $IMAGE_NAME_WEBLOGIC:$IMAGE_TAG_WEBLOGIC)
100+
docker cp $id:/u01/oracle/wlserver/server/lib/wlthint3client.jar $SCRIPTPATH
101+
docker rm -v $id
102+
}
97103
export SCRIPTPATH="$( cd "$(dirname "$0")" > /dev/null 2>&1 ; pwd -P )"
98104
export PROJECT_ROOT="$SCRIPTPATH/../../../.."
99105
export RESULT_ROOT=${RESULT_ROOT:-/scratch/$USER/wl_k8s_test_results}
@@ -192,7 +198,8 @@ elif [ "$JENKINS" = "true" ]; then
192198

193199
/usr/local/packages/aime/ias/run_as_root "mkdir -p $PV_ROOT/acceptance_test_pv_archive"
194200
/usr/local/packages/aime/ias/run_as_root "chmod 777 $PV_ROOT/acceptance_test_pv_archive"
195-
201+
202+
get_wlthint3client_from_image
196203
else
197204
pull_tag_images
198205

@@ -203,4 +210,6 @@ else
203210

204211
export JAR_VERSION="`grep -m1 "<version>" pom.xml | cut -f2 -d">" | cut -f1 -d "<"`"
205212
docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy --build-arg no_proxy=$no_proxy -t "${IMAGE_NAME_OPERATOR}:${IMAGE_TAG_OPERATOR}" --build-arg VERSION=$JAR_VERSION --no-cache=true .
206-
fi
213+
214+
get_wlthint3client_from_image
215+
fi

0 commit comments

Comments
 (0)