Ensure that you have read the
Integration post.
In this post, we will demonstrate the culmination of the previous posts into a seamless integration.
Create a Project
The Oracle Maven Plugin will generate a SOA application complete with the necessary pom's and directory structure.
Navigate to the cloned Git directory and generate a SOA project using the Maven Archetype.
mvn archetype:generate -DarchetypeGroupId=com.oracle.soa.archetype -DarchetypeArtifactId=oracle-soa-application -DarchetypeVersion=12.1.3-0-0 -DgroupId=com.bjwallen.example -DartifactId=Demo -Dversion=1.0-SNAPSHOT -DprojectName=Echo
Two important items of note:
- Maven expects that arguments -DartifactId and -DProjectName are unique. If the names are duplicated in both arguments, Maven with throw an exception, "[ERROR] Project '[name]' is duplicated in the reactor."
- Maven and Jenkins expect the parent pom.xml to be in the root of the project; however, when you create a project using the archetype in the Git directory, the parent pom.xml is buried one level deeper in the file system - ../Demo/Echo/pom.xml.
- Move all files in ../Demo/Echo one level higher. You must rename and eventually delete the ../Demo directory.
Modify the Project POM
A few modifications need made to the project pom.xml to:
- Execute a SOA TestSuite,
- Correct an error,
- Direct Maven where to distribute the snapshot, and
- Communicate information about SCM, the organization, and the developer.
Navigate to the ../Demo/pom.xml file.
Uncomment line 55 <jndi.properties.input> and modify it as follows:
<jndi.properties.input>${scac.input.dir}/testsuites/jndi.properties</jndi.properties.input>
The jndi.properties file will be created in a moment.
On line 74, replace
rev${version}.jar with
rev${project.version}.jar, else Maven will complain about it when any goal is executed.
After line 132, the </build> element, add the following <profiles> to direct Maven where to store the compiled artifact.
<profiles>
<profile>
<id>ede</id>
<activation>
<property>
<name>env</name>
<value>ede</value>
</property>
</activation>
<distributionManagement>
<repository>
<id>snapshots</id>
<name>Snapshots Repository</name>
<url>http://ci:8081/repository/snapshots</url>
</repository>
</distributionManagement>
</profile>
<profile>
<id>ite</id>
<activation>
<property>
<name>env</name>
<value>ite</value>
</property>
</activation>
<distributionManagement>
<repository>
<id>ite</id>
<name>Integrated Test Repository</name>
<url>http://ci:8081/repository/ite</url>
</repository>
</distributionManagement>
</profile>
<profile>
<id>ivv</id>
<activation>
<property>
<name>env</name>
<value>ivv</value>
</property>
</activation>
<distributionManagement>
<repository>
<id>ivv</id>
<name>Independent Validation and Verification Repository</name>
<url>http://ci:8081/repository/ivv</url>
</repository>
</distributionManagement>
</profile>
<profile>
<id>prd</id>
<activation>
<property>
<name>env</name>
<value>prd</value>
</property>
</activation>
<distributionManagement>
<repository>
<id>prd</id>
<name>Production Repository</name>
<url>http://ci:8081/repository/prd</url>
</repository>
</distributionManagement>
</profile>
</profiles>
Following the </profiles> element, add the following SCM, organization, and developers information.
<scm>
<connection>scm:git://oracle@ci/ci/git/demo.git</connection>
<developerConnection>scm:git:[fetch=]ssh://oracle@ci/ci/git/demo.git[push=]ssh://oracle@ci/ci/git/demo.git</developerConnection>
<tag>HEAD</tag>
</scm>
<organization>
<name>BJWallen</name>
<url>http://blog.bjwallen.com</url>
</organization>
<developers>
<developer>
<id>myid</id>
<name>Bill Wallen</name>
<email>bill@bjwallen.com</email>
<roles>
<role>architect</role>
<role>developer</role>
</roles>
</developer>
</developers>
Modify the Application POM
Edit ../Demo/pom.xml.
After the closing </modules> element on line 11, insert the same data that was just inserted into the project pom into the application pom.
<profiles>
<profile>
<id>ede</id>
<activation>
<property>
<name>env</name>
<value>ede</value>
</property>
</activation>
<distributionManagement>
<repository>
<id>snapshots</id>
<name>Snapshots Repository</name>
<url>http://ci:8081/repository/snapshots</url>
</repository>
</distributionManagement>
</profile>
<profile>
<id>ite</id>
<activation>
<property>
<name>env</name>
<value>ite</value>
</property>
</activation>
<distributionManagement>
<repository>
<id>ite</id>
<name>Integrated Test Repository</name>
<url>http://ci:8081/repository/ite</url>
</repository>
</distributionManagement>
</profile>
<profile>
<id>ivv</id>
<activation>
<property>
<name>env</name>
<value>ivv</value>
</property>
</activation>
<distributionManagement>
<repository>
<id>ivv</id>
<name>Independent Validation and Verification Repository</name>
<url>http://ci:8081/repository/ivv</url>
</repository>
</distributionManagement>
</profile>
<profile>
<id>prd</id>
<activation>
<property>
<name>env</name>
<value>prd</value>
</property>
</activation>
<distributionManagement>
<repository>
<id>prd</id>
<name>Production Repository</name>
<url>http://ci:8081/repository/prd</url>
</repository>
</distributionManagement>
</profile>
</profiles>
<scm>
<connection>scm:git://oracle@ci/ci/git/demo.git</connection>
<developerConnection>scm:git:[fetch=]ssh://oracle@ci/ci/git/demo.git[push=]ssh://oracle@ci/ci/git/demo.git</developerConnection>
<tag>HEAD</tag>
</scm>
<organization>
<name>BJWallen</name>
<url>http://blog.bjwallen.com</url>
</organization>
<developers>
<developer>
<id>myid</id>
<name>Bill Wallen</name>
<email>bill@bjwallen.com</email>
<roles>
<role>architect</role>
<role>developer</role>
</roles>
</developer>
</developers>
Create the jndi.properties File
Navigate to the SOA project testsuites directory ../Echo/SOA/testsuites.
vi jndi.properties
java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
java.naming.provider.url=t3://ci:8001/soa-infra
java.naming.security.principal=weblogic
java.naming.security.credentials=welcome1
dedicated.connection=true
dedicated.rmicontext=true
Create a SOA Composite
At this point, a SOA composite should be created to deploy to the environment and execute automated SOA tests. The example used in this post can be pulled from GitHub.
Before code is committed to the master, ensure that the SOA environment is in a running state.
Watch an Automated Build
Commit code to the local repository, and execute a push to the master. Then, watch Jenkins kick off an automated build.
Open a browser, and navigate to http://[host]:8080.
Click the Demo build.
Click Git Polling Log to view the execution of the Git commit hook.
When the build kicks off, right-click the working build and select Console Output.
Watch the build execute.
The following is an abridged build output.
Started by user Bill Wallen
Building in workspace /var/lib/jenkins/workspace/Demo
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url /ci/git/demo.git # timeout=10
Fetching upstream changes from /ci/git/demo.git
> git --version # timeout=10
> git fetch --tags --progress /ci/git/demo.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision d2c0e19c34b6d76d83feef43da796512ecba2606 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f d2c0e19c34b6d76d83feef43da796512ecba2606
> git rev-list d2c0e19c34b6d76d83feef43da796512ecba2606 # timeout=10
provisoning config files...
copy managed file [ciSettings] to file:/tmp/config9216960584909663262tmp
Parsing POMs
using settings config with name ciSettings
Replacing all maven server entries not found in credentials list is true
Modules changed, recalculating dependency graph
Established TCP socket on 52836
[Demo] $ /usr/java/jdk1.7.0_75/bin/java -Djava.awt.headless=true -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven32-agent-1.7.jar:/ci/apps/apache-maven-3.3.3/boot/plexus-classworlds-2.5.2.jar:/ci/apps/apache-maven-3.3.3/conf/logging jenkins.maven3.agent.Maven32Main /ci/apps/apache-maven-3.3.3 /var/cache/jenkins/war/WEB-INF/lib/remoting-2.52.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven32-interceptor-1.7.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.7.jar 52836
<===[JENKINS REMOTING CAPACITY]===>channel started
using settings config with name ciSettings
Replacing all maven server entries not found in credentials list is true
Executing Maven: -B -f /var/lib/jenkins/workspace/Demo/pom.xml -s /tmp/settings7158704502475689892.xml clean deploy
[INFO] Scanning for projects...
... Jenkins downloads dependencies ...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Echo
[INFO] Demo
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Echo 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
... Jenkins downloads plugins ...
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Echo ---
[INFO] Deleting /var/lib/jenkins/workspace/Demo/Echo/target
[INFO]
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ Echo ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /var/lib/jenkins/workspace/Demo/Echo/src/main/resources
[INFO]
[INFO] --- oracle-soa-plugin:12.1.3-0-0:compile (default-compile) @ Echo ---
[INFO] ------------------------------------------------------------------------
[INFO] ORACLE SOA MAVEN PLUGIN - COMPILE
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ABOUT TO RUN oracle.soa.scac.ValidateComposite...
[INFO] compile: Executing: [cmd:[/usr/java/jdk1.7.0_75/bin/java, -Djava.protocol.handler.pkgs=oracle.mds.net.protocol|oracle.fabric.common.classloaderurl.handler|oracle.fabric.common.uddiurl.handler, oracle.soa.scac.ValidateComposite, /var/lib/jenkins/workspace/Demo/Echo/SOA//composite.xml, -level=1]]
[INFO] Process being executed, waiting for completion.
[INFO] [exec] Oct 20, 2015 2:45:36 PM oracle.fabric.common.wsdl.SchemaManager isIncrementalBuildSupported
[INFO] [exec] INFO: XMLSchema incremental build enabled.
[INFO] [exec] BPEL/EchoBPEL.bpel:29: warning: There are no explicit "import" statements in <bpel:process> "EchoBPEL" as required by BPEL 2.0 standard.
[INFO] [exec] BPEL/EchoBPEL.bpel:49: warning: The from-spec of "xsd:string" is not compatible with to-spec of "ns1:replyMessage"
[INFO] [exec] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO] [exec] >> modified xmlbean locale class in use
[INFO] [exec] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO] compile: [cmd:[/usr/java/jdk1.7.0_75/bin/java, -Djava.protocol.handler.pkgs=oracle.mds.net.protocol|oracle.fabric.common.classloaderurl.handler|oracle.fabric.common.uddiurl.handler, oracle.soa.scac.ValidateComposite, /var/lib/jenkins/workspace/Demo/Echo/SOA//composite.xml, -level=1]] exit code=0
[INFO] SOA COMPILE DONE
[INFO]
[INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) @ Echo ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /var/lib/jenkins/workspace/Demo/Echo/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ Echo ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.19:test (default-test) @ Echo ---
[INFO] No tests to run.
[JENKINS] Recording test results[INFO]
[INFO] --- oracle-soa-plugin:12.1.3-0-0:sar (default-sar) @ Echo ---
[INFO] Building sar: /var/lib/jenkins/workspace/Demo/Echo/target/sca_Echo_rev1.0-SNAPSHOT.jar
[INFO]
[INFO] --- oracle-soa-plugin:12.1.3-0-0:deploy (default-deploy) @ Echo ---
[INFO] ------------------------------------------------------------------------
[INFO] ORACLE SOA MAVEN PLUGIN - DEPLOY COMPOSITE
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] setting user/password..., user=weblogic
Processing sar=/var/lib/jenkins/workspace/Demo/Echo/target/sca_Echo_rev1.0-SNAPSHOT.jar
Adding sar file - /var/lib/jenkins/workspace/Demo/Echo/target/sca_Echo_rev1.0-SNAPSHOT.jar
INFO: Creating HTTP connection to host:ci, port:7003
INFO: Received HTTP response from the server, response code=200
---->Deploying composite success.
[INFO]
[INFO] --- oracle-soa-plugin:12.1.3-0-0:test (default-test) @ Echo ---
[INFO] native formatting
[INFO] native
[INFO] [<test:testRunResults compositeDN="default/Echo" errorCount="1" failureCount="0" testCount="1" passCount="0" inProgressCount="0" runId="ba85477c0c70e5eb:6e0e12d8:1505e758abd:-7fe1" runName="oracle-soa-plugin-scatest" startDate="2015-10-20T14:45:41.314-04:00" endDate="2015-10-20T14:45:41.435-04:00" xmlns:test="http://xmlns.oracle.com/sca/2006/test"><test:testSuite suiteName="Basic"><test:testResult compositeDN="default/Echo!1.0*soa_84814344-be85-4288-b088-c94157bdd699" flowId="28" scaPartitionId="1" endDate="2015-10-20T14:45:41.435-04:00" startDate="2015-10-20T14:45:41.336-04:00" suiteName="Basic" testName="Basic.xml" testRunName="oracle-soa-plugin-scatest" testRunId="ba85477c0c70e5eb:6e0e12d8:1505e758abd:-7fe1" outcome="errored" callHandlerClassName=""><test:wireActionResults wireSource="Demo"><test:assertionOutcome outcome="errored"><test:diff>Received fault, expected output, check log for details on fault </test:diff></test:assertionOutcome></test:wireActionResults></test:testResult></test:testSuite><test:property propertyName="db.type" propertyValue="oracle"/><test:property propertyName="bpel.host.name" propertyValue="ci"/><test:property propertyName="soa.oracle.home" propertyValue="/u01/fmw/soa"/></test:testRunResults>]
[INFO] /tmp/out/oracle-soa-plugin-scatest.xml
[JENKINS] Recording test results[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ Echo ---
[INFO] Installing /var/lib/jenkins/workspace/Demo/Echo/target/sca_Echo_rev1.0-SNAPSHOT.jar to /ci/repository/com/bjwallen/example/Echo/1.0-SNAPSHOT/Echo-1.0-SNAPSHOT.jar
[INFO] Installing /var/lib/jenkins/workspace/Demo/Echo/pom.xml to /ci/repository/com/bjwallen/example/Echo/1.0-SNAPSHOT/Echo-1.0-SNAPSHOT.pom
[INFO]
[INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) @ Echo ---
[INFO] Downloading: http://ci:8081/repository/snapshots/com/bjwallen/example/Echo/1.0-SNAPSHOT/maven-metadata.xml
[INFO] Number of application's worked threads is 4
[INFO] Downloaded: http://ci:8081/repository/snapshots/com/bjwallen/example/Echo/1.0-SNAPSHOT/maven-metadata.xml (359 B at 39.0 KB/sec)
[INFO] Uploading: http://ci:8081/repository/snapshots/com/bjwallen/example/Echo/1.0-SNAPSHOT/Echo-1.0-20151020.184631-2.jar
[INFO] Uploaded: http://ci:8081/repository/snapshots/com/bjwallen/example/Echo/1.0-SNAPSHOT/Echo-1.0-20151020.184631-2.jar (23 KB at 209.0 KB/sec)
[INFO] Uploading: http://ci:8081/repository/snapshots/com/bjwallen/example/Echo/1.0-SNAPSHOT/Echo-1.0-20151020.184631-2.pom
[INFO] Uploaded: http://ci:8081/repository/snapshots/com/bjwallen/example/Echo/1.0-SNAPSHOT/Echo-1.0-20151020.184631-2.pom (9 KB at 74.4 KB/sec)
[INFO] Downloading: http://ci:8081/repository/snapshots/com/bjwallen/example/Echo/maven-metadata.xml
[INFO] Downloaded: http://ci:8081/repository/snapshots/com/bjwallen/example/Echo/maven-metadata.xml (317 B at 44.2 KB/sec)
[INFO] Uploading: http://ci:8081/repository/snapshots/com/bjwallen/example/Echo/1.0-SNAPSHOT/maven-metadata.xml
[INFO] Uploaded: http://ci:8081/repository/snapshots/com/bjwallen/example/Echo/1.0-SNAPSHOT/maven-metadata.xml (768 B at 10.6 KB/sec)
[INFO] Uploading: http://ci:8081/repository/snapshots/com/bjwallen/example/Echo/maven-metadata.xml
[INFO] Uploaded: http://ci:8081/repository/snapshots/com/bjwallen/example/Echo/maven-metadata.xml (316 B at 3.9 KB/sec)
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Demo 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Demo ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ Demo ---
[INFO] Installing /var/lib/jenkins/workspace/Demo/pom.xml to /ci/repository/com/bjwallen/example/Demo/1.0-SNAPSHOT/Demo-1.0-SNAPSHOT.pom
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ Demo ---
[INFO] Downloading: http://ci:8081/repository/snapshots/com/bjwallen/example/Demo/1.0-SNAPSHOT/maven-metadata.xml
[INFO] Downloaded: http://ci:8081/repository/snapshots/com/bjwallen/example/Demo/1.0-SNAPSHOT/maven-metadata.xml (360 B at 23.4 KB/sec)
[INFO] Uploading: http://ci:8081/repository/snapshots/com/bjwallen/example/Demo/1.0-SNAPSHOT/Demo-1.0-20151020.184632-11.pom
[INFO] Uploaded: http://ci:8081/repository/snapshots/com/bjwallen/example/Demo/1.0-SNAPSHOT/Demo-1.0-20151020.184632-11.pom (4 KB at 37.1 KB/sec)
[INFO] Downloading: http://ci:8081/repository/snapshots/com/bjwallen/example/Demo/maven-metadata.xml
[INFO] Downloaded: http://ci:8081/repository/snapshots/com/bjwallen/example/Demo/maven-metadata.xml (317 B at 51.6 KB/sec)
[INFO] Uploading: http://ci:8081/repository/snapshots/com/bjwallen/example/Demo/1.0-SNAPSHOT/maven-metadata.xml
[INFO] Uploaded: http://ci:8081/repository/snapshots/com/bjwallen/example/Demo/1.0-SNAPSHOT/maven-metadata.xml (599 B at 73.1 KB/sec)
[INFO] Uploading: http://ci:8081/repository/snapshots/com/bjwallen/example/Demo/maven-metadata.xml
[INFO] Uploaded: http://ci:8081/repository/snapshots/com/bjwallen/example/Demo/maven-metadata.xml (316 B at 38.6 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Echo ............................................... SUCCESS [ 58.606 s]
[INFO] Demo ............................................... SUCCESS [ 0.517 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:25 min
[INFO] Finished at: 2015-10-20T14:46:33-04:00
[INFO] Final Memory: 25M/140M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving /var/lib/jenkins/workspace/Demo/pom.xml to com.bjwallen.example/Demo/1.0-SNAPSHOT/Demo-1.0-SNAPSHOT.pom
[JENKINS] Archiving /var/lib/jenkins/workspace/Demo/Echo/pom.xml to com.bjwallen.example/Echo/1.0-SNAPSHOT/Echo-1.0-SNAPSHOT.pom
[JENKINS] Archiving /var/lib/jenkins/workspace/Demo/Echo/target/sca_Echo_rev1.0-SNAPSHOT.jar to com.bjwallen.example/Echo/1.0-20151020.184631-2/Echo-1.0-20151020.184631-2.jar
Deleting 1 temporary files
channel stopped
Finished: SUCCESS